Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion AD_Users_Create/CreateUsers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,16 @@
if ($passwordinDesc -lt 10) {
$description = 'Just so I dont forget my password is ' + $pwd
}else{}

$exists = $null
try {
$exists = Get-ADUSer $name -ErrorAction Stop
} catch{}

if($exists){
return $true
}

new-aduser -server $setdc -Description $Description -DisplayName $name -name $name -SamAccountName $name -Surname $name -Enabled $true -Path $ouLocation -AccountPassword (ConvertTo-SecureString ($pwd) -AsPlainText -force)


Expand All @@ -276,11 +286,12 @@
try{Set-ADUser -Identity $name -UserPrincipalName "$upn" }
catch{}

return $false
################################
#End Create User Objects
################################

}




6 changes: 4 additions & 2 deletions Invoke-BadBlood.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ if ($badblood -eq 'badblood') {
.($basescriptPath + '\AD_Users_Create\CreateUsers.ps1')
$createuserscriptpath = $basescriptPath + '\AD_Users_Create\'
do {
createuser -Domain $Domain -OUList $ousAll -ScriptDir $createuserscriptpath
$status = createuser -Domain $Domain -OUList $ousAll -ScriptDir $createuserscriptpath
Write-Progress -Activity "Random Stuff into A domain - Creating $UserCount Users" -Status "Progress:" -PercentComplete ($x / $UserCount * 100)
$x++
if($status -eq $false){
$x++
}
}while ($x -lt $UserCount)

#Group Creation
Expand Down