Last active
August 29, 2015 14:15
-
-
Save vinyar/22f45f20327a7eba8403 to your computer and use it in GitHub Desktop.
Configuring DNS and WINS for Win2k8r2 NIC to allow domain joining
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Import-Module ActiveDirectory | |
$ou = (Get-ADOrganizationalUnit -Filter 'New Members').DistinguishedName | |
redircmp $ou | |
redirusr $ou |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-Computer -domainname DOMAIN -OUPath "OU=OU1,OU=OU2,OU=Domainname,DC=company,DC=com" -cred DOMAIN\AuthorizedUser -passthru –verbose |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
powershell_script 'configure WINS on NIC_1' do | |
code <<-BLOCK | |
$Nic = Get-WMIObject Win32_NetworkAdapter |where{$_.NetConnectionID -eq "Local Area Connection"} | |
$Config = Get-WMIObject Win32_NetworkAdapterConfiguration |where{$_.MACAddress -eq $Nic.MACAddress} | |
$pri = $config.winsprimaryserver | |
$sec = $config.winsSecondaryServer | |
$config.SetWinsServer("#{node['ad_wrapper']['primary_wins']}","#{node['ad_wrapper']['secondary_wins']}") | |
$Config.SetDNSServerSearchOrder("#{node['ad_wrapper']['primary_wins']}") | |
BLOCK | |
end | |
# any more nics and im making it a loop | |
powershell_script 'configure WINS on NIC_2' do | |
code <<-BLOCK | |
$Nic = Get-WMIObject Win32_NetworkAdapter |where{$_.NetConnectionID -eq "Local Area Connection 2"} | |
$Config = Get-WMIObject Win32_NetworkAdapterConfiguration |where{$_.MACAddress -eq $Nic.MACAddress} | |
$pri = $config.winsprimaryserver | |
$sec = $config.winsSecondaryServer | |
$config.SetWinsServer("#{node['ad_wrapper']['primary_wins']}","#{node['ad_wrapper']['secondary_wins']}") | |
$Config.SetDNSServerSearchOrder("#{node['ad_wrapper']['primary_wins']}") | |
BLOCK | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment