I’m trying to add a computer to the domain via PS 2.0 but everytime I run the script I get
Add-Computer : This command cannot be executed on target computer (‘ComputerName’) due to following error: The parameter is incorrect.
At C:.…
- Add-Computer <<<< -DomainName domain.local -Cred $cre -Unsecure
* CategoryInfo : InvalidOperations: (ComputerName:String) [Add-Computer], InvalidOperationException
* FullyQualifiedErrorId : InvalidOperationsException.Microsoft.PowerShell.Commands.AddComputerCommand
HEre is the script I have
#Gather Computer Type $floorou = Read-Host 'What floor will the user be in:' $ComputerOU = 'ou='+$floorou+',ou=Computers,ou=city,dc=domain,dc=local' #Gather Info $Username = Read-Host 'Employee Username' # get the credential $cred = get-credential # enter the computer in the right place Add-Computer -DomainName domain.local -Credential $cred -OUPath $ComputerOU -Unsecure