Problem retrieving Value for DynamicSiteName from Registry using PS

Applies to: Windows 8 EnterpriseWindows 8 ProWindows Server 2012 Datacenter


Retrieving DynamicSiteName Value from the registry in 

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters REG_SZ DynamicSiteName 

using Powershell e.g.

(Get-ItemProperty "HKLM:\System\CurrentControlSet\Services\Netlogon\parameters")."DynamicSiteName" 

This also happens on Windows 7 and Windows Server 2008 R2 whhen this update has been installed on the system

2506143 Description of Windows Management Framework 3.0 for Windows 7 SP1 and Windows Server 2008 R2 SP1

The returned value ends with some unexpected characters


"Default-First-Site-Name E" 

instead of 



The netlogon Service writes this registry value and appends a NULL character plus a random character at the end.

This is not visible from standard applications like Regedit.exe, as most of the applications terminate the string with the ending NULL character. Since Update 2506143 the Framework returns the complete character Array.




Use this call to return the DynamicSiteName value limited with the ending NULL character


More Information

Newer versions of Windows will write the DynamicSiteName in the correct Format.

Note: There might be other REG_SZ values in the registry in malformed format, caused by other applications and tools. The workaround will always return the correct string value.