Skip to content

Instantly share code, notes, and snippets.

@aytch
Created January 25, 2016 23:34
Show Gist options
  • Select an option

  • Save aytch/9f2be7ea56bf7409b9fd to your computer and use it in GitHub Desktop.

Select an option

Save aytch/9f2be7ea56bf7409b9fd to your computer and use it in GitHub Desktop.
$domain = "ADATUM.com"
$username = "$domain\myUserAccount"
$password = "myPassword!" | ConvertTo-SecureString -asPlainText -Force;
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
$DomainJoinArgs = @{
'DomainName' = $domain;
'Credential' = $credential;
'OuPath' = "";
'Server' = "[servername here]";
}
Add-Computer @DomainJoinArgs -PassThru
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment