MilesLogan
asked on
Remove an AD group from multiple servers
Hi EE
I have the script below that someone here helped me with to nest a Domain group into the Administrators group into multiple machines .. Would it be as easy as changing ".add" to .remove ? I tried it and it worked but I don't want to run it on 100 servers without confirmation from the experts .
$ErrorActionPreference = "Stop"
GC Servers.txt | %{
$Serv = $_
$domain="MyDomain"
$group = "GroupName"
Try {
([adsi]"WinNT://$Serv/Admi nistrators ,group").A dd("WinNT: //$domain/ $group,gro up")
"" | Select @{N="Server";e={$Serv}},@{ N="Status" ;e={"Succe ss"}}
}
Catch{
"" | Select @{N="Server";e={$Serv}},@{ N="Status" ;e={"Faile d"}}
}
}
I have the script below that someone here helped me with to nest a Domain group into the Administrators group into multiple machines .. Would it be as easy as changing ".add" to .remove ? I tried it and it worked but I don't want to run it on 100 servers without confirmation from the experts .
$ErrorActionPreference = "Stop"
GC Servers.txt | %{
$Serv = $_
$domain="MyDomain"
$group = "GroupName"
Try {
([adsi]"WinNT://$Serv/Admi
"" | Select @{N="Server";e={$Serv}},@{
}
Catch{
"" | Select @{N="Server";e={$Serv}},@{
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER