Webservice - AD

Oct 19, 2009 at 10:01 PM


I'm still trying to get this webservice up running, so I could really need some help on this.

Keep running in to some trouble.

Downloaded both "MaikKoster.Deployment_v5" and "CustomBootWizard_V2".

When I try to use "GetSCCMAssignedSite", "GetSCCMAssignedSiteByIPAddress", "GetSCCMSite" or "GetSCCMSiteByIPAddress", the result is empty (the others in AD.asmx works... ??)

And have the following in logfile:

AD Webservice: Specified Domain is DC=mydomain,DC=local
AD Webservice: Specified Username is mydomain.local\Administrator
Constructor: Trying to create new Active Directory Root Entry for Domain DC=mydomain,DC=local
Constructor: Using credentials for supplied Username mydomain.local\Administrator
Constructor: Created new Active Directory Root Entry LDAP://DC=mydomain,DC=local
IPToDecimal: Parsed IP Address to 3232235801
GetSystemManagement: Found "System Management" OU at LDAP://CN=System Management,CN=System,DC=mydomain,DC=local
GetSCCMAssignedSite: Searching for SCCM AssignedSite for IP Address
GetSCCMAssignedSite: Searching within all objects of objectClass mSSMSRoamingBoundaryRange
GetSCCMAssignedSite: Not found within objects of objectClass mSSMSRoamingBoundaryRange.
GetSite: Searching for Active Directory Site for IP Address
IPInSubnet: Check if IP is within subnet
IPToDecimal: Parsed IP Address to 3232235801
IPToDecimal: Parsed IP Address to 3232235776
IPInSubnet: IP is within subnet
GetSite: Found Site ConfigManagerSite for IP Address
GetSCCMAssignedSite: Searching within all objects of objectClass = mSSMSSite
GetSCCMSite: Active Directory site not found in objects of objectClass mSSMSSite.
GetSCCMSite: Loop again through Property mSSMSRoamingBoundaries interpreting IP Subnets.
GetSCCMAssignedSite: Could not find SCCM AssignedSite for IP Address


I'm not sure if I have to change something in the files in "CustomBootWizard_V2"...(Besides "SCCM_Bootstrap.ini)... ? F.ex. the "Site Code"...?



If I use "UnknownComputer.asmx" -> "GetAssignedSite" from MDT 2010, I'm able to get the "Site Code".

But I'm not sure if I can implement this instead.

Or is it a problem with permission to "System Management" in AD... ??

I hope someone have some hints, as I can't get any further right now.

Best regards.


Oct 20, 2009 at 9:24 AM


There are generally two ways of getting information about the SCCM Assigned Site. You can query the Service Locator Point (SLP) or you can get the information from Active Directory. Both need to be configured. Querying Active Directory can sometimes become a pain as there are often several ways how something can be defined and how it can be stored in AD. The current functions try to evaluate the assigned site based on the different ways you can define the boundary in SCCM (IP Subnet, Active Directory Site, IP Address Range, etc). Looking at the log you provided it simply can't evaluate the IP Address into an assigned site. So there might be an issue with the configured boundaries. For troubleshooting this you can use a tool like ADExplorer to verify the information in AD. Just open it and connect to your local Domain. within your default domain Container you should find a container named "System" and within another Container called "System Management". Within this container you can find more or less all the information about SCCM Active Directory is aware of. So typically you should either have an entry similar to SMS-SiteCode-IPRangeLow-IPRangeHigh and SMS-Site-SiteCode. Just check if a boundary has been configured and is visible for the site you requested.

The fastest way to get it working is probably configuring a SLP and use the "GetAssignedSiteByIP" from the SCCM.asmx webservice. It is more or less identical to the "GetAssignedSite" from the original MDT webservice. The information in the SCCM_Bootstrap.ini file defines How a webservice is called. This could look like


The actual call to the webservice is executed within the file ZTIMediaHook.wsf in Line 96

' Get assigned Site
 oEnvironment.Item("AssignedSite") = GetAssignedSite

This is calling the Function "GetAssignedSite" further down in the script starting at line 170. You could simply replace this with the function from the original MDT Example. It looks like this (copied from MDT Source files):

Function GetAssignedSite
 Dim oAdapters
 Dim oAdapter
 Dim sElement
 Dim i
 Dim arrIPBytes
 Dim arrSubnetBytes
 Dim sSubnet
 Dim index
 Dim oService
 Dim oXML
 Dim sAssignedSite

 ' Create the web service instance
 Set oService = new WebService
 oService.IniFile = "SCCM_Bootstrap.ini"
 oService.SectionName = "GetAssignedSite"

 ' Check each IP/subnet looking for an assigned site
 Set oAdapters = objWMI.ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled = 1")
 For each oAdapter in oAdapters
  If not (IsNull(oAdapter.IPAddress)) then
   i = 0
   For each sElement in oAdapter.IPAddress
    If sElement = "" or Left(sElement, 7) = "169.254" or sElement = "" then
     oLogging.CreateEntry "Ignoring IP Address " & sElement, LogTypeInfo
    ElseIf Instr(sElement, ":") > 0 then
     oLogging.CreateEntry "Ignoring IPv6 Address " & sElement, LogTypeInfo
     ' Calculate the subnet number
     sSubnet = ""
     arrIPBytes = Split(sElement, ".")
     arrSubnetBytes = Split(oAdapter.IPSubnet(i), ".")
     For index = 0 to 3
      sSubnet = sSubnet & CStr( CInt(arrIPBytes(index)) and CInt(arrSubnetBytes(index)) ) & "."
     sSubnet = Mid(sSubnet, 1, Len(sSubnet) - 1)

     ' Call the web service
     oEnvironment.Item("SiteIP") = sElement
     oEnvironment.Item("SiteSubnet") = sSubnet
     oEnvironment.Item("SiteMACAddress") = oAdapter.MacAddress
     Set oXML = oService.Query
     If oXML is Nothing then
      oLogging.CreateEntry "Unable to query web service.", LogTypeWarning
      sAssignedSite = ""
      sAssignedSite = oXML.SelectSingleNode("string").Text
     End if
     If sAssignedSite <> "" then
      Exit For
     End if
    End if
    If sAssignedSite <> "" then
     Exit For
    End if
    i = i + 1
  End if

 GetAssignedSite = sAssignedSite
End Function

After these change the example BootWizard should query the SLP for this information and the rest should work as before.