?
Solved

Add usernames to the power user groups

Posted on 2009-04-10
11
Medium Priority
?
346 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 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
Learn about cloud computing and its benefits for small business owners.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

771 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