Skip to content

Instantly share code, notes, and snippets.

@Dan1el42
Last active August 29, 2015 14:01
Show Gist options
  • Select an option

  • Save Dan1el42/b553ad3a51e8fef025d6 to your computer and use it in GitHub Desktop.

Select an option

Save Dan1el42/b553ad3a51e8fef025d6 to your computer and use it in GitHub Desktop.
Set the DNS suffix search list via CIM (remote or local) without group policy. Most relevant for Win2008 R2 and earlier. Win2012 and later comes with cmdlets.
$WsmanSession = New-CimSession -ComputerName 'Win2008R2Server', 'Win2012Server', 'Win2012R2Server'
$DcomSession = New-CimSession -ComputerName 'WinXP', 'Win2003Server' -SessionOption (New-CimSessionOption -Protocol Dcom)
$InvokeSplat = @{
CimSession = $WsmanSession, $DcomSession
ClassName = 'Win32_NetworkAdapterConfiguration'
MethodName = 'SetDNSSuffixSearchOrder'
Arguments = @{DNSDomainSuffixSearchOrder=@('contoso.lab','viamonstra.lab')}
}
Invoke-CimMethod @InvokeSplat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment