Skip to content

Instantly share code, notes, and snippets.

@michaellwest
Created January 30, 2016 02:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaellwest/42afbd773d8837915072 to your computer and use it in GitHub Desktop.
Save michaellwest/42afbd773d8837915072 to your computer and use it in GitHub Desktop.
Generate test users with a random generated name.
Import-Module SPE
$session = New-ScriptSession -Username "admin" -Password "b" -ConnectionUri "http://remotesitecore"
$jobId = Invoke-RemoteScript -Session $session -ScriptBlock {
foreach($num in 0..10) {
$key = -join ((65..90) + (97..122) | Get-Random -Count 7 | % {[char]$_})
New-User -Identity "TestUser$($key)" -Enabled -Password "b" | Out-Null
}
} -AsJob
Wait-RemoteScriptSession -Session $session -Id $jobId -Delay 60
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment