Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Friday, March 9, 2018 12:39 PM
Hello,
im preparing windows image for deployment, and a part of my script add newly created computer to domain.
Before first restart, i need to modify settings which u can do via GUI "Right Click My Computer>Properties>Advanced System Settings>Computer Name>Change>More"
I require to change DNS suffix to srv.domain.com and uncheck "Change primary DNS suffix".
Part of my setupcomplete.cmd (well the script is calling MyScript.ps1) is..
$ADParams = @{
DomainName = "domain.com"
OUPath = "myOU"
NewName = "Server1"
Credential = $cred
}
Add-Computer @ADParams
get-netadapter | set-dnsclient -connectionspecificsuffix srv.domain.com -registerthisconnectionsaddress:$false
restart-computer
.. which, i believed, will join my newly created computer to domain and change this DNS suffix.
But it changed Connection-specific DNS suffix instead of Primary Dns Suffix (well, i used wrong cmdlet obviously and changed something i didnt want to change).
I know it could be changed via GPO .. but I want to do this via PS. Any tips?
All replies (2)
Monday, March 12, 2018 4:10 AM âś…Answered
Hi,
According to your description, the above script actually changes the DNS suffix in the network adapter, the following screenshot for your reference:
While the DNS suffix settings based on the screenshot above are stored in the registry, you can modify them by using the following command:
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters -Name 'NV Domain' -Value srv.domain.com
Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters -Name SyncDomainWithMembership -Value 0
# Restart-Computer
If you need further help, please feel free to let us know.
Best Regards,
Albert
Please remember to mark the replies as an answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected]
Monday, March 12, 2018 7:51 AM
Yeah, I found the registry example yesterday .. will test it asap. Thanks