Created
March 8, 2015 15:34
-
-
Save andreasbotsikas/09b5e8ec9d0cd59c64b7 to your computer and use it in GitHub Desktop.
Create multiple local users
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script based on http://stackoverflow.com/questions/383390/create-local-user-with-powershell-windows-vista | |
# Creates 30 users that are administrators and belong to the Remote Desktop Users group. | |
function create-account ([string]$accountName) { | |
$hostname = hostname | |
$comp = [adsi]"WinNT://$hostname" | |
$user = $comp.Create("User", $accountName) | |
$user.SetPassword("pass@word1") | |
$user.SetInfo() | |
$User.UserFlags[0] = $User.UserFlags[0] -bor 0x10000 #ADS_UF_DONT_EXPIRE_PASSWD flag is 0x10000 | |
$user.SetInfo() | |
$objOU = [ADSI]"WinNT://$hostname/Administrators,group" | |
$objOU.add("WinNT://$hostname/$accountName") | |
$objOU = [ADSI]"WinNT://$hostname/Remote Desktop Users,group" | |
$objOU.add("WinNT://$hostname/$accountName") | |
} | |
# Create 30 administrator users named user1 ... user 30 | |
for($i=1; $i -le 30; $i++){ | |
create-account("user$i") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do oyu run this script, I am a QA and I need to create multiple github accounts to load eth onto external wallets for testing a new block chain crypto currency rewards platform. Thanks