Skip to content

Instantly share code, notes, and snippets.

@andreasbotsikas
Created March 8, 2015 15:34
Show Gist options
  • Save andreasbotsikas/09b5e8ec9d0cd59c64b7 to your computer and use it in GitHub Desktop.
Save andreasbotsikas/09b5e8ec9d0cd59c64b7 to your computer and use it in GitHub Desktop.
Create multiple local users
# 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")
}
@flqa1
Copy link

flqa1 commented Feb 23, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment