Is it possible to add a local user then add that user to a group of my
choosing. All the samples and tutorials I have found implies new user can
only be added to the administrators group (objLocalAdmGroup)

Thanks

Re: Add A User, Add User To Group by trading_jacks

trading_jacks
Fri Oct 13 15:26:01 CDT 2006

strComputer = "atl-ws-01"
Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer")
objGroup.Add(objUser.ADsPath)


Just change "/Administrators" to "/Power Users" or whatever you have
setup.

if you need to add a domain user to the local group do this:

Set oWshNet = CreateObject("WScript.Network")
strComputer = oWshNet.ComputerName


Set objGroup = GetObject("WinNT://" & strComputer & "/Power Users")

Set objUser = GetObject("WinNT://Domain/AD Object")

On Error Resume Next
objGroup.Add(objUser.ADsPath)
On Error Goto 0


Re: Add A User, Add User To Group by Dean

Dean
Mon Oct 16 13:57:13 CDT 2006

Thanks for the tip. Just one question: Your script looks like its assuming
and active directory environment. Does this script work on stand-alone
servers?

Dean


"trading_jacks" <MARKFERGASON@gmail.com> wrote in message
news:1160771161.724946.44250@h48g2000cwc.googlegroups.com...
> strComputer = "atl-ws-01"
> Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
> Set objUser = GetObject("WinNT://" & strComputer & "/kenmyer")
> objGroup.Add(objUser.ADsPath)
>
>
> Just change "/Administrators" to "/Power Users" or whatever you have
> setup.
>
> if you need to add a domain user to the local group do this:
>
> Set oWshNet = CreateObject("WScript.Network")
> strComputer = oWshNet.ComputerName
>
>
> Set objGroup = GetObject("WinNT://" & strComputer & "/Power Users")
>
> Set objUser = GetObject("WinNT://Domain/AD Object")
>
> On Error Resume Next
> objGroup.Add(objUser.ADsPath)
> On Error Goto 0
>