# PS 2.0 Join Domain

**URL:** <https://forums.powershell.org/t/ps-2-0-join-domain/8376>\
**Category:** PowerShell Help\
**Created:** [April 6, 2017, 11:33am UTC](https://forums.powershell.org/t/ps-2-0-join-domain/8376 "2017-04-06T11:33:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chajones](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@chajones](https://forums.powershell.org/u/chajones)\
**Post date:** [April 6, 2017, 11:33am UTC](https://forums.powershell.org/t/ps-2-0-join-domain/8376/1 "2017-04-06T11:33:44Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![chajones](https://avatars.discourse-cdn.com/v4/letter/c/b9e5f3/32.png) [@chajones](https://forums.powershell.org/u/chajones)\
**Post date:** [April 6, 2017, 12:56pm UTC](https://forums.powershell.org/t/ps-2-0-join-domain/8376/2 "2017-04-06T12:56:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:38pm UTC](https://forums.powershell.org/t/ps-2-0-join-domain/8376/3 "2024-05-16T20:38:56Z")

</div>


