Guest User

Untitled

a guest
Oct 8th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. Param(
  2. [string]$dnsServer01,
  3. [string]$dnsServer02,
  4. [string]$adPassword,
  5. [string]$domain
  6. )
  7.  
  8. Set-PSDebug -Trace 1
  9.  
  10. # Install MS AD Tools
  11. Install-WindowsFeature -Name GPMC,RSAT-AD-PowerShell,RSAT-AD-AdminCenter,RSAT-ADDS-Tools,RSAT-DNS-Server
  12.  
  13. # Set DNS Servers to New AD Server
  14. Set-DNSClientServerAddress -interfaceIndex 3 -ServerAddresses ($dnsServer01,$dnsServer02)
  15.  
  16. # Join the domain now.
  17. $password = ConvertTo-SecureString $adPassword -asPlainText -Force
  18. $username = "$domain\Administrator"
  19. $credential = New-Object System.Management.Automation.PSCredential($username,$password)
  20. Add-Computer -DomainName $domain -Credential $credential
  21.  
  22. # Restart our computer
  23. Restart-Computer -Confirm:$false
Add Comment
Please, Sign In to add comment