Solved

Add usernames to the power user groups

Posted on 2009-04-10
11
337 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 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
 
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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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 Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now