Setting NT Primary Group via ADSI

G

Guest

Guest
Archived from groups: microsoft.public.adsi.general,microsoft.public.windowsnt.misc (More info?)

I am looking for a way to remove disabled users from Domain Users via a script. Do do this, I will need change the primary group to another group, and then remove Domain Users. I have a script which will tell me the primary group:

Set usr = GetObject("WinNT://INDEPENDENCE/jsmith,user")
grpPrimaryID = usr.Get("PrimaryGroupID")

But, I cannot find a script method for changing the primary group. I was able to determine the ID (RID) of the group I want to change to, but I cannot do a set to change it.

I was able to find a script to change the primary group for Win2k, but not for NT4. Can someone help? This is very important to us as a second layer of security for disabled users.

KPM
 
G

Guest

Guest
Archived from groups: microsoft.public.adsi.general,microsoft.public.windowsnt.misc (More info?)

Add the user to the group first, then set the priamarygroupid, then remove the
user from the domain users group.

Note the group you are adding the user to as primary must be a global or
universal security group.

joe

--
Joe Richards Microsoft MVP Windows Server Directory Services
www.joeware.net



KPM wrote:
> I am looking for a way to remove disabled users from Domain Users via a script. Do do this, I will need change the primary group to another group, and then remove Domain Users. I have a script which will tell me the primary group:
>
> Set usr = GetObject("WinNT://INDEPENDENCE/jsmith,user")
> grpPrimaryID = usr.Get("PrimaryGroupID")
>
> But, I cannot find a script method for changing the primary group. I was able to determine the ID (RID) of the group I want to change to, but I cannot do a set to change it.
>
> I was able to find a script to change the primary group for Win2k, but not for NT4. Can someone help? This is very important to us as a second layer of security for disabled users.
>
> KPM
>
>