?
Solved

Add usernames to the power user groups

Posted on 2009-04-10
11
Medium Priority
?
358 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
  • 4
  • 2
  • 2
  • +3
11 Comments
 
LVL 5

Assisted Solution

by:wpathan
wpathan earned 800 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
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
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 1200 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…
Learn about cloud computing and its benefits for small business owners.
Is your organization moving toward a cloud and mobile-first environment? In this transition, your IT department will encounter many challenges, such as navigating how to: Deploy new applications and services to a growing team Accommodate employee…
Free Data Recovery software is an advanced solution from Kernel Tools to recover data and files such as documents, emails, database, media and pictures, etc. It supports recovery from physical & logical drive after a hard disk crash, accidental/inte…

601 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