I have been trying for most of the day now to transform the following
vbscript into visual basic .net 2005 with no luck whatsoever. The script
adds an existing security group in active directory into a remote computer's
Administrators group.
vbscript
Set oAdminGroup = GetObject("WinNT://ServerName/Administrators,group")
oAdminGroup.Add "WinNT://Domain/SecurityGroup,group"
Call oAdminGroup.SetInfo
visual basic .net 2005
Dim oAdminGroup As New DirectoryEntry("WinNT://ServerName/Administrators")
oAdminGroup.Children.Add(SecurityGroup, "group")
oAdminGroup.CommitChanges()
The following Error is what I receive:
System.InvalidOperationException: The Active Directory object located at the
path WinNT://ServerName/Administrators is not a container.
Any thoughts would be great. Thanks.
visual basic .net 2005 Dim oAdminGroup As New DirectoryEntry("WinNT://ServerName/Administrators") oAdminGroup.Invoke("Add", New Object() {"WinNT://DomainName/GroupName"}) oAdminGroup.CommitChanges()