PowerShell – create multiple AD Computers

#-------------[deklarations]--------------------------
#source
$computers=Get-Content '\\fs00.domain.example\admins\deploy\hostnames.txt'
#logs
$successLog=
$errorLog=
$unreachableLog=
$reportLog=
#params
$header=
#-------------[functions]--------------------------
foreach($computer in $computers) {
    New-ADComputer -Name $computer -SamAccountName $computer -Path "OU=deploy,OU=DOMAIN-Computers,DC=spp,DC=local"
}

Leave a Reply

Your email address will not be published. Required fields are marked *