PS 2.0 Join Domain

This topic contains 1 reply, has 1 voice, and was last updated by  Chad Nathan Jones 5 months, 2 weeks ago.

  • Author
    Posts
  • #68161

    Chad Nathan Jones
    Participant

    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

  • #68172

    Chad Nathan Jones
    Participant

    Using -Unsecure on the Add-Computer was causing the issue

You must be logged in to reply to this topic.