Created
January 30, 2016 02:10
-
-
Save michaellwest/42afbd773d8837915072 to your computer and use it in GitHub Desktop.
Generate test users with a random generated name.
This file contains 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
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