virzone
asked on
How to add user to Power User group?
Anyone can assist me on how do i add all my network users to the default local power user group on their desktop with simplest and less administrative method?
Use a logon Script to Do it...With tha ADSI Functions.
Put this Code in a .VBS File and call it as a Logon Script.
Dim wshNW
Dim pdcName, ComputerName,UserName
Set wshNw = WScript.CreateObject("Wscr ipt.networ k")
PdcName = wshNW.UserDomain
ComputerName = wshNW.ComputerName
UserString = wshNW.UserName
GroupString = "Power Users"
Set GroupObj = GetObject("WinNT://" & ComputerName & "/" & GroupString)
GroupObj.Add ("WinNT://" & PdcName & "/" & UserString)
Set DomainObj = Nothing
Set GroupObj = Nothing
Put this Code in a .VBS File and call it as a Logon Script.
Dim wshNW
Dim pdcName, ComputerName,UserName
Set wshNw = WScript.CreateObject("Wscr
PdcName = wshNW.UserDomain
ComputerName = wshNW.ComputerName
UserString = wshNW.UserName
GroupString = "Power Users"
Set GroupObj = GetObject("WinNT://" & ComputerName & "/" & GroupString)
GroupObj.Add ("WinNT://" & PdcName & "/" & UserString)
Set DomainObj = Nothing
Set GroupObj = Nothing
Question: in what security context does your scheduler run. Default as SYSTEM or did you change it?
If it is either as local administrator or SYSTEM then you could add the "net localgroup" command to all computers in your network.
All Active copmuters will be stored in machines.txt. If you habe a list of all the computers then comment-out the "net view"-line.
Carefull, in the FOR line there are double spaces and double "%". They are needed... copy carefully.
Regards,
Eric
---- script 1 ----
@echo off
set MACHINES=c:\temp\machines.
set LOGFILE=c:\temp\logfile.tx
set ERRORLOG=c:\temp\errorlog.
net view >%MACHINES%
FOR /F "eol= tokens=1 delims=\ " %%a IN (%MACHINES%) DO start /w AddUsers.cmd %%a >%LOGFILE% 2>%ERRORLOG
---- end script 1 -----
---- script 2 ----
@echo off
AT \\%1 HH:MM net localgroup Powerusers Domain\Username1 /add
AT \\%1 HH:MM net localgroup Powerusers Domain\Username2 /add
.....
.....
---- end script 1 -----
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- PAQ'd and points removed
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
PaShA
I will leave a recommendation in the Cleanup topic area that this question is:
- PAQ'd and points removed
Please leave any comments here within the
next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !
PaShA
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Deploy the Switch User utility to all desktops. This will allow to to script the change using an account with admin rights. Then using the SU service run this line in your logon script (the account needs to be a domain admin.
SU <account> "net localgroup "power users" "DOMAIN-NAME\domain users" /ADD" DOMAIN-NAME<\\server\share