Skip to content
Snippets Groups Projects
Commit 69586206 authored by Martin Čuchran's avatar Martin Čuchran
Browse files

Update AddOStoDomUPS.ps1

parent cfae63fd
No related branches found
No related tags found
No related merge requests found
......@@ -7,5 +7,37 @@ NET LOCALGROUP Administrators PB007 /add;
NET USER admin /delete;
$secpasswd = ConvertTo-SecureString "V&Kx64H-cf_TaFan4YcG" -AsPlainText -Force;
$mycreds = New-Object System.Management.Automation.PSCredential ("UPS\addtodomOPENSTACK", $secpasswd);
Add-Computer -DomainName "ups.ucn.muni.cz" -OUPath "OU=PB009,OU=OPENSTACK,DC=ups,DC=ucn,DC=muni,DC=cz" -Restart -Credential $mycreds;
Add-Computer -DomainName "ups.ucn.muni.cz" -OUPath "OU=PB009,OU=OPENSTACK,DC=ups,DC=ucn,DC=muni,DC=cz" -Credential $mycreds;
$rawData = Invoke-WebRequest -Uri "https://is.muni.cz/www/396462/pb007.json"
$data = $rawData | ConvertFrom-Json
$data.computers | %{
$pcName = $_.hostname
$userNames = $_.users
if($_.hostname -eq $env:computername){
Write-Output "Hostname: $($env:computername)"
$currentData = net localgroup "Remote Desktop Users"
$userNames | %{
if($currentData -like "*ucn\$($_)*"){
"ucn\$($_) already member of group"
}else{
Write-Output "ucn\$($_)"
NET LOCALGROUP "Remote Desktop Users" "ucn\$($_)" /add;
}
}
}
}
Stop-Transcript;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment