April 15 2012

How to tell which PXE/WDS server a machine booted from

I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.


I had a requirement to be able to tell which PXE or WDS server my Windows machine had booted from. If a Windows machine boots from PXE, a response packet containing boot server information (such as the IP address and name of the network boot server) is inserted into the registry at HKLMSystemCurrentControlSetControlPXE. I simply used a VBScript to grab this IP address and then used NBTSTAT to resolve the name.

' Obtain IP address of PXE from registry
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\" & strComputer & "rootdefault:StdregProv")
strKeypath = "SYSTEMCurrentControlSetControlPXE"
strEntryName = "BootServerReply"
objReg.GetBinaryValue HKEY_LOCAL_MACHINE, strKeyPath, strEntryName, arrValue
PXEServerIP = arrvalue(20) & "." & arrValue(21) & "." & arrValue(22) & "." & arrValue(23)

' Resolve PXE Server IP address to name using NBTSTAT
Dim sIP : sIP = PXEServerIP
Dim oWAN : Set oWAN = WScript.Arguments.Named
If oWAN.Exists( "ip" ) Then sIP = oWAN( "ip" )
Dim oWSH : Set oWSH = CreateObject( "WScript.Shell" )
Dim sCmd : sCmd = "nbtstat -A " & sIP
Dim sText : sText = oWSH.Exec( sCmd ).Stdout.ReadAll
Dim PXEServerName : PXEServerName = "Name not resolved"
Dim oRE : Set oRE = New RegExp
oRE.Pattern = "s*(w+)s+<20>"
Dim oMTS : Set oMTS = oRE.Execute( sText )
If 1 = oMTS.Count Then
PXEServerName = oMTS( 0 ).SubMatches( 0 )
End if

' Output PXE Server IP and Name
Wscript.Echo "This machine started via PXE boot from PXE server " & PXEServerIP & " (" & PXEServerName & ")"


I use a maximum of one Google Ad per post to help offset some of my blog hosting costs.


July 28 2011


I was having an issue with very slow download of the WinPE WIM image, the screen shows ‘Windows is loading files …’ but it takes between 7 minutes and 1 hour to load the 150mb WIM file over a 100mb link.
After spending a lot of time looking into this, and changing a lot of settings including WDS TFTP block (65536) and window size (64), the RamDiskTFTPBlockSize setting in HKEY_LOCAL_MACHINESOFTWAREwow6432nodeMicrosoftSMSPXE (http://sccm.haas.se/?p=15), the final solution involved settings on the Intel teaming settings on the PXE server:

I needed to leave Jumbo Packets disabled as the client couldn’t handle it and it failed. I increased Transmits and Receive Buffers to maximum values of 2048 and performance was dramatically increased.

Once this was changed, the WIM download was well under 1 minute!


March 23 2010

Windows Deployment Services (WDS) cache

We’ve had a constant frustration where clients would try to PXE boot more than once within an one hour period with the result being that the PXE boot fails. This problem occurs because of a PXE cache limitation (1 hour) set by default.

You can also confirm this configuration by looking in the smspxe.log file:

Loaded PXE settings from reg key HKLMSoftwareMicrosoftSMSPXE:
PXE Settings:
IsActive: Yes
SupportUnknownMachines: No
ResponseDelay: 0
CacheExpire: 3600
HTTP Port: 80
HTTPS Port: 443
IISSSLState: 0x0
BindPolicy: Exclude
Root CA Certs:
PXE GUID: fab8bfcc-3b15-431a-828d-fbfd184c3813

To fix this, reduce the cache size. Open regedit and navigate to HKEY_LOCAL_MACHINESoftwareMicrosoftSMSPXE (or for 64-bit OS, head to HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftSMSPXE). Modify the CacheExpire DWORD and set it to a lower value, in my case I set it to decimal value of 1, meaning that cache will only last for 1 second.

Restart the WDS service.

Further info here – http://support.microsoft.com/kb/2019640