Longtime lurker. First time poster.
I've been trying to get this working for a week now and my head hurts. I'm in charge of new Citrix XenDesktop/XenApp golden images. I'm converting a bunch of our registry script files to powershell. I'm stuck on the DHCP settings. I'm trying to get Powershell to query the TcpIp\Parameters\Interfaces for each of my values and clear them
Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\*' |
Select-Object -Property DhcpDefaultGateway,DhcpDomain,DhcpNameServer,DhcpSubnetMaskOpt,DhcpIPAddress,DhcpServer,DhcpSubnetMask |
Clear-ItemProperty -Name DhcpDefaultGateway,DhcpDomain,DhcpNameServer,DhcpSubnetMaskOpt,DhcpIPAddress,DhcpServer,DhcpSubnetMask -Force
I know that doesn't work but you get what I'm trying to do. I've tried any and all variations to get this to work. Because we will have a few dozen VMs (Win7 and 2012), putting in the GUID for the NIC won't work. This is the registry script I'm currently calling from the PS file:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters]
“NameServer”=””
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\{GUID}]
“NameServer”=””
“Domain”=””
“DhcpIPAddress”=””
“DhcpSubnetMask”=””
“DhcpServer”=””
“DhcpNameServer”=””
“DhcpDefaultGateway”=””
I can't do an "ipconfig /release" as this will break it's connection to PVS. Any help would be awesome! Thank you in advance!