Re: Add domain user to local group script troubleshoot
From: Rick Kalifa (rkalifa_at_hotmail.com.NO_SPAM)
Date: 03/25/04
- Next message: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Previous message: Richard Mueller [MVP]: "Re: Script to get installed software and server applications on remote servers"
- In reply to: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Next in thread: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Reply: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 25 Mar 2004 13:54:27 -0600
This script works great!!
What I would like to with this is get a list of all the workstations, so I
can add the group I need to the local administrators.
In the past, I've exported a list, and ran a job against the list of
computers. However, I'd like to take it one step further and have the script
find the workstations dynamically and then apply the changes I need on that
workstation.
Any input here would be appreciated.
RK.
"Richard Mueller [MVP]" <rlmueller-NOSPAM@ameritech.NOSPAM.net> wrote in
message news:OChpsfiEEHA.3576@TK2MSFTNGP12.phx.gbl...
> mtothej wrote:
>
> > I am trying the following script to add a domain user to a local group:
> >
> > Set objGroup = GetObject _
> > ("WinNT://remotecomputer/Administrators")
> > Set objUser = GetObject _
> > ("LDAP://CN=username,OU=MyOU,OU=MyOU,DC=root,DC=mydomain,DC=org")
> > objGroup.Add(objUser.ADsPath)
> >
> > I get the following error:
> >
> > C:\Scripts\add_domain_user_to_local_group.vbs(5, 1) Active Directory: An
> invalid
> > Active Directory pathname was passed
> >
> > I know the ADsPath for the user is correct because I can retrieve
> properties from it. I know the objGroup path is correct because I can
> enumerate the current users in the group.
> >
> > Is something wrong in the last line? Am I on the right track or is there
> another way to add a domain user to a local group? Thanks :)
>
> You must bind to the user object with the WinNT provider. If the
> "cn=Username" user has sAMAccountName equal to "username", and the NetBIOS
> name of the domain is "MyDomain", then use
>
> Set objUser = GetObject("WinNT://MyDomain/username,user")
>
> The local group object's Add method does not understand an LDAP AdsPath.
>
> --
> Richard
> Microsoft MVP Scripting and ADSI
> HilltopLab web site - http://www.rlmueller.net
> --
>
>
- Next message: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Previous message: Richard Mueller [MVP]: "Re: Script to get installed software and server applications on remote servers"
- In reply to: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Next in thread: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Reply: Richard Mueller [MVP]: "Re: Add domain user to local group script troubleshoot"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|