Skip to content

Instantly share code, notes, and snippets.

@adionditsak
Created August 4, 2014 12:51
Show Gist options
  • Save adionditsak/220f36ecd023af61968b to your computer and use it in GitHub Desktop.
Save adionditsak/220f36ecd023af61968b to your computer and use it in GitHub Desktop.
Adds/signs server to AD/Active Directory
# Set DNS to Primary AD
$eth = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled ='true'";
$dns_servers = "1.2.3.4"
$eth.SetDNSServerSearchOrder($dns_servers);
# Add domain
$domain = "domain.local"
$password = "password" | ConvertTo-SecureString -asPlainText -Force
$username = "$domain\Administrator"
$credential = New-Object System.Management.Automation.PSCredential($username,$password)
Add-Computer -DomainName $domain -Credential $credential
#Restgart
restart-computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment