Windows 2008 R2 Powershell 2.0 Adding Local Users Script
I have over 30 Windows 2008 R2 with no Active Directory / all on a workgroup. I would like to set up a CV file and import into Power Shell 2.0 with 5 to 10 users set up with their:
Username | First Name | Last Name | Set as Administrator Group | Password | etc.
I have a few scripts but wanted to find out the best way to do this, again its adding Local user accounts.
Any feedback Greatly appreciated.Rob Jung ADRWeb
November 4th, 2011 5:09pm
Local user accounts as in local to a computer? Exchange won't use those. You might want to ask that in the Windows development forum.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
November 4th, 2011 5:34pm
I mean user accounts on the server that the users can remote in as themselves.Rob Jung ADRWeb
November 4th, 2011 5:46pm
Exchange requires domain accounts.Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
Free Windows Admin Tool Kit Click here and download it now
November 4th, 2011 9:21pm
Hi Rob,
This forum is special for Exchange server users. Please seek the solution in the
Windows PowerShell (Windows server) forum:
http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/
Similar post for reference:
Adding local users with PS
http://social.technet.microsoft.com/Forums/en/winserverpowershell/thread/bb25cf05-d2c9-4359-b3d4-14a0663a51f5
Frank Wang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.
November 7th, 2011 2:12am
My first attempt didn't work, something like this, I'm still trying to get the right Syntax to add many users to my W2K8R2 Server:
function Create-Users
{
$UserInfoFile = "C:\Powershell\users.csv"
$users = Import-Csv $UserInfoFile
foreach ($user in $users)
{
$group = $user.Group
$currentName = hostname
$objOu = [ADSI]"WinNT://$currentName"
$objUser = $objOU.Create("User", $user.Login)
$objUser.setpassword($user.Password)
$objUser.SetInfo()
$objUser.description = "$($user.User)"
$objUser.SetInfo()
$objOU = [ADSI]"WinNT://$currentName/$group,group"
$objOU.add("WinNT://$currentName/$($user.Login)")
}
Rob Jung ADRWeb
Free Windows Admin Tool Kit Click here and download it now
November 7th, 2011 9:45am
Hi Rob,
This forum is special for Exchange server users. Please seek the solution in the
Windows PowerShell (Windows server) forum:
http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/
Similar post for reference:
Adding local users with PS
http://social.technet.microsoft.com/Forums/en/winserverpowershell/thread/bb25cf05-d2c9-4359-b3d4-14a0663a51f5
Frank Wang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
tnmff@microsoft.com.
November 7th, 2011 10:11am
Hi Rob,
What's the file format of the C:\Powershell\users.csv? please post it here.
What't the error/result when you run the script?
Frank Wang
Free Windows Admin Tool Kit Click here and download it now
November 8th, 2011 3:37am
Hi Rob,
Any updates?
Frank Wang
November 9th, 2011 8:34pm
CSV is formated as:
user,login,password,group
John Smith,jsmith,******,administrator
How would I add both users and remote desktop users (local users) in the Import-CSV?
I'm using this import script which works but is ther a way to output the users and passwords to import into new servers so the users don't have to change their password again on new servers.
Again I'm not using Active Directory, since the business requirment for these servers are stand along servers on workgroup.
Thanks in advance, any help greatly appreciated,
RobRob Jung ADRWeb
Free Windows Admin Tool Kit Click here and download it now
November 10th, 2011 5:30pm