functions/Add-UsersX.ps1
<#
.SYNOPSIS Create X number of users. .DESCRIPTION Used for dev/testing to create multiple users in one environment. All users will contain a prefix and user number as part of the username. .EXAMPLE Add-UsersX 500 "true" "user" "password" #> Function Add-UsersX { [cmdletbinding()] param( [Parameter(Mandatory=$true)] [Int] $NumberOfUsers, [Parameter(Mandatory=$true)] [String] $IsAdmin, [Parameter(Mandatory=$true)] [String] $NewUserPrefix, [Parameter(Mandatory=$false)] [String] $NewUserPassword ) If($NewUserPassword -eq "") { $NewUserPassword = "password" } For ($i=1; $i -le $NumberOfUsers; $i++) { $UserNum = $i.ToString() $UserNum = $UserNum.PadLeft(5,"0") $NewUserName = $NewUserPrefix + $UserNum $CreateUser = Add-User $NewUserName $NewUserPassword "local" $IsAdmin Write-Verbose ( $CreateUser | Format-Table | Out-String ) } } |