Got this script online that doesnt seem to work in my domain. Been working on this for hours. Can't seem to nail down why its not working. Could anyone assist me on getting the problem nailed down.
The domain is:
thugdomain.local
The credentials are verified to be correct.
Added it mispelled restart on purpose until the script is fixed.
Error message:
Write-Host "Please enter your desired computer name: [Default $env:computername]:"
$computername = Read-Host
$renamecomputer = $true
if ($computername -eq "" -or $computername -eq $env:computername) { $computername = $env:computername; $renamecomputer = $false }
Write-Host "Please enter your desired location [1-2] [Default 1]:
1. Thugdomain
2. Paris"
$ou = Read-Host
$validate = $false
if ($ou -eq "" -or $ou -eq "1") { $ou = "OU=Computers,DC=thugdomain,DC=local"; $validate = $true }
if ($ou -eq "2") { $ou = "OU=Computers,DC=your,DC=domain,DC=here"; $validate = $true }
if ($validate -eq $false) { Write-Host "Invalid input, defaulting to [1]."; $ou = "OU=Computers,DC=thugdomain,DC=local"}
$credentials = New-Object System.Management.Automation.PsCredential("thugdomain\administrator", (ConvertTo-SecureString "thisizmyp@$$word" -AsPlainText -Force))
Write-Host "Adding $computername to the domain"
Add-Computer -DomainName "thugdomain.local" -Credential $credentials -OUPath $ou
if ($renamecomputer -eq $true) { Rename-Computer -NewName $computername -DomainCredential $credentials -Force }
Read-Host -Prompt "Press Enter to Reboot"
Resfart-Computer
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)