VBScript to C#
-
Hi, Can anyone please tell me how to convert following script into C# code.
strComputer = "atl-ws-01"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser In objGroup.Members
If objUser.Name <> "Administrator" AND objUser.Name <> "Domain Admins" Then
objGroup.Remove(objUser.AdsPath)
End If
NextThanks, Mushq
-
Hi, Can anyone please tell me how to convert following script into C# code.
strComputer = "atl-ws-01"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
For Each objUser In objGroup.Members
If objUser.Name <> "Administrator" AND objUser.Name <> "Domain Admins" Then
objGroup.Remove(objUser.AdsPath)
End If
NextThanks, Mushq
string strComputer = "atl-ws-01"; objGroup = GetObject(@"WinNT://" + strComputer + @"/Administrators"); foreach( objUser In objGroup.Members) { if( (objUser.Name != "Administrator") && (objUser.Name != "Domain Admins")) objGroup.Remove(objUser.AdsPath); }
Ahsan Ullah Senior Software Engineer
-
string strComputer = "atl-ws-01"; objGroup = GetObject(@"WinNT://" + strComputer + @"/Administrators"); foreach( objUser In objGroup.Members) { if( (objUser.Name != "Administrator") && (objUser.Name != "Domain Admins")) objGroup.Remove(objUser.AdsPath); }
Ahsan Ullah Senior Software Engineer
Ahsan, thank you very much for the reply, can you please tell me what should be the data type of variable objGroup and how to use objGroup in foreach loop. Thanks a lot, Mushq
Regards, Mushq