April 17 2012

SCCM 2012 Active Directory Schema changes

I’ve previously blogged about the AD schema changes made by SCCM 2007 (http://blog.danovich.com.au/2010/11/03/sccm-active-directory-schema-changes/).

Recently I prepared an environment for SCCM 2012 – the schema extension is exactly the same for SCCM 2012 so if you have already extended it for SCCM 2007, there’s no need to extend it for SCCM 2012.

As before, it creates 4 new classes and 18 associated attributes as follows:

attribute cn=MS-SMS-Site-Code
attribute cn=mS-SMS-Assignment-Site-Code.
attribute cn=MS-SMS-Site-Boundaries.
attribute cn=MS-SMS-Roaming-Boundaries.
attribute cn=MS-SMS-Default-MP.
attribute cn=mS-SMS-Device-Management-Point.
attribute cn=MS-SMS-MP-Name.
attribute cn=MS-SMS-MP-Address.
attribute cn=mS-SMS-Health-State.
attribute cn=mS-SMS-Source-Forest.
attribute cn=MS-SMS-Ranged-IP-Low.
attribute cn=MS-SMS-Ranged-IP-High.
attribute cn=mS-SMS-Version.
attribute cn=mS-SMS-Capabilities.
class cn=MS-SMS-Management-Point.
class cn=MS-SMS-Server-Locator-Point.
class cn=MS-SMS-Site.
class cn=MS-SMS-Roaming-Boundary-Range.


April 15 2012

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

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 & ")"