Solved

Add usernames to the power user groups

Posted on 2009-04-10
11
344 Views
Last Modified: 2012-05-06
Dear,
I need to add 200 usernames as part of power users group, each user name should be added in the power users group for his computer only, in summary suppose I have the following:
username1      computer1
username2      computer2
username3      computer3
.
.
Username100  computer100
I need to add username1 in the powerusers group of computer1
add username2 in the powerusers group of computer2
and so on, please how to accomplish this task?
0
Comment
Question by:mahmoud_2008
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 5

Assisted Solution

by:wpathan
wpathan earned 200 total points
ID: 24116562
you can create a batch file and share it on a common folder or make it run through a logon script, use the following commands.
Replace the YourDomain with name of your domain and Domain Users with
%username%

Hope this helps.
net localgroup "Power Users" "YourDomain\domain users" /add
 
net localgroup "power users" "Yourdomain\%username%" /add

Open in new window

0
 
LVL 6

Expert Comment

by:mickeyfan
ID: 24116567
Try

Net Localgroup Power USers "Domain_Name\User" /Add
0
 
LVL 2

Expert Comment

by:pankaj0079
ID: 24116571
As using ur given example
username1      computer1

right click my computer-manage-local user and groups

create username1 then in groups open power user groups
click on add, type username or click on advanced then click find now
select username1-ok

now it become power user
0
Free NetCrunch network monitor licenses!

Only on Experts-Exchange: Sign-up for a free-trial and we'll send you your permanent license!

Here is what you get: 30 Nodes | Unlimited Sensors | No Time Restrictions | Absolutely FREE!

Act now. This offer ends July 14, 2017.

 
LVL 5

Expert Comment

by:mfhorizon
ID: 24116589
log in using network administrator to the user1's pc,
go to control panel > user accounts
on USERS tab click ADD
select user name and domain or search using BROWSE button

Once completed the user will be shown in the USERS tab on the userAccounts screen.
select the newly added user, click PROPERTIES button
select GROUP MEMBERSHIP tab, select 'OTHERS' radio button and choose POWER USER from the dropdown combo.

I think you need to repeat this process on every user's pc.

Good Luck
0
 
LVL 1

Author Comment

by:mahmoud_2008
ID: 24121111
Dear wpathan,mickyfan:
Your script will add the user for all PCs, the issue is that each user will be added to the power users group of his computer only.

Dear pankaj0079, mfhorizon:
This is a manual approach and I need an automatic script to accomplish this.
  Regards
0
 
LVL 5

Expert Comment

by:wpathan
ID: 24121205
My script will not add all the users to power users.
If you run this script as a logon script it will add the currently logged on user in the power users group and that too on that pc only.
Give it a try in two or three pcs.
0
 
LVL 31

Accepted Solution

by:
Henrik Johansson earned 300 total points
ID: 24121755
One way to accomplish the task is to let a script loop through textfile/list with username/computername and use psexec to execute 'net localgroup' remote.
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

@echo off
for /F "tokens=1,2" %%a in (list.txt) do psexec \\%%b net localgroup "power users" %USERDOMAIN%\%%a /add

Open in new window

0
 
LVL 1

Author Comment

by:mahmoud_2008
ID: 24125249
Hi henjoh09,
I did a test file called  list.txt   with the following format  
username1/computre1
username2/computer2
username3/computer3
as test.vbs

copy the code and change   %USERDOMAIN%  with mydomain
   and (list.txt)    with c:\list.txt

then issue the command:
c:\test.vbs   itdisplay an error in line 2,5
0
 
LVL 1

Author Comment

by:mahmoud_2008
ID: 24129170
Wpathan,
I run your script as a logon script through group policy but it display an error because it needs to run as administrator privilages.
 How to do this?
0
 
LVL 31

Expert Comment

by:Henrik Johansson
ID: 24136916
%USERDOMAIN% environment variable shall not nead to be changed. It will be parsed by system automatically.

The format of file in sample of http:#24121755 nead to be "user computer" (space or tab separated as described in question). To get another separator like /, it's done with delims option as shown in snippet below.
Sorry for the confusion when I wrote username/computername in previous post as it wasn't ment to be the syntax of the file.

The error message is caused by you tried to run the script as a vbs instead of correct batch extension (bat or cmd).
Save the codesnippet as bulkpowerusers.cmd (or *.bat).

@echo off
for /F "delims=/ tokens=1,2" %%a in (c:\list.txt) do psexec \\%%b net localgroup "power users" %USERDOMAIN%\%%a /add

Open in new window

0
 
LVL 1

Author Closing Comment

by:mahmoud_2008
ID: 31568943
Thanks Guys, I am splitting the points between you since both solutions are working.
0

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question