Tagged: BDD

PXE Filter (v4.1.501)

Got a comment on another post from Thomas who was asking for a version of the PXE Filter that works.

I have used this one on a few installations.

You need to configure:
sProviderServer if you have the PXE point on another server
sSiteCode for your site
sCollection to the collection which you advertise your deployment task sequence

What the PXEFilter does is (in general):

  • Check if the machine exist, and if not adds it to the SCCM.
  • Checks if the machine is member of a specific collection (sCollection) and if not adds it to the collection (Direct member)
  • Waits until the machine can see the advertisment (A maximum of 30 seconds)

PXEFilter.vbs v4.1.501 (Download VBS)

' //***************************************************************************
' // ***** Script Header *****
' //
' // Solution:  Microsoft Deployment Toolkit
' // File:      PXEFilter.vbs
' //
' // Purpose:   Decide what needs to be done for each PXE requests received
' //            by WDS.  If not present in the ConfigMgr database, add it.
' //
' // Usage:     (loaded automatically by Microsoft.BDD.PXEFilter DLL)
' //
' // Microsoft Solution Version:  4.1.501
' // Microsoft Script Version:    4.1.501
' // Customer Build Version:      1.0.0
' // Customer Script Version:     1.0.0
' //
' // Microsoft History:
' // 4.0.501 MTN  02/19/2008  Added header, additional logging, advertisement
' //                          verification for every request.
' //
' // Customer History:
' //
' // ***** End Header *****
' //***************************************************************************

'//  Set global variables, used by the ZTIProcess function below.  (Note that
'//  any changes to this script will require restarting the WDS service, since
'//  the script is only loaded once and kept in memory as long as the service
'//  is running.)
'//  If ConfigMgr is running on the same server as WDS, the sProviderServer
'//  value can be left blank and the sUsername and sPassword values must be
'//  blank.

Option Explicit

Dim sProviderServer
Dim sSiteCode
Dim sNamespace
Dim sUsername
Dim sPassword
Dim sCollection

sProviderServer = ""
sSiteCode = "ABC"
sNamespace = "root\sms\site_" & sSiteCode
sUsername = ""
sPassword = ""
sCollection = "ABC00004"   ' This must be a collection ID, not a collection name

'//  Main routine


Function ZTIProcess

	Dim sMacAddress
	Dim sIPAddress
	Dim sUUID
	Dim sNetBiosName
	Dim oLocator
	Dim oSMS
	Dim sQuery
	Dim bFound
	Dim iResourceID
	Dim re
	Dim oSite
	Dim oParams
	Dim oResult
	Dim oLastError
	Dim oClients
	Dim oClient
	Dim oCollection
	Dim oNewRule
	Dim oAdvertisement
	Dim bTrying
	Dim sAdvert
	Dim i

	' Initialization

	sMacAddress = PXE.MacAddress
	sIPAddress = PXE.IPAddress

	Set re = New RegExp
	re.Pattern = ":"
	re.Global = true
	sNetBiosName = "MAC" & re.Replace(sMacAddress, "")

	' Clear invalid UUID values

	If sUUID = "00000000-0000-0000-0000-000000000000" or sUUID = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF" then
		sUUID = ""
	End if

	' Log details

	PXE.LogTrace "Processing request from MAC address = " & sMacAddress & ", IP address = " & sIPAddress & ", UUID = " & sUUID

	'//  Filter requests.  This may need to be customized if you only want some
	'//  network segments to be supported.

	' Ignore ConfigMgr "ping" requests

	If PXE.IPAddress = "" or PXE.MacAddress = "FF:FF:FF:FF:FF:FF" then
		PXE.LogTrace "Ignoring ConfigMgr ping request"
		Exit Function
	End if

	'//  Verify the computer is known to ConfigMgr

	' Connect to the SMS provider

	Set oLocator = CreateObject("WbemScripting.SWbemLocator")
	Set oSMS = oLocator.ConnectServer(sProviderServer, sNamespace, sUsername, sPassword)

	' Build the query

	sQuery = "SELECT * FROM SMS_R_System WHERE MacAddresses = '" & sMacAddress & "'"
	If sUUID <> "" then
		sQuery = sQuery & " OR SMBIOSGUID = '" & sUUID & "'"
	End if

	' Process the query

	bFound = False
	Set oClients = oSMS.ExecQuery(sQuery)
	For each oClient in oClients
		bFound = true
		iResourceID = oClient.ResourceID
		PXE.LogTrace "Found existing machine " & oClient.NetbiosName & " with ResourceID = " & iResourceID
		sNetBiosName = oClient.NetbiosName
		Exit For

	'//  If necessary, add the computer to the ConfigMgr database

	If not bFound then 

		PXE.LogTrace "Could not find machine with MAC address '" & sMacAddress & "' or SMBIOS UUID '" & sUUID & "'."

		' Add the computer

		Set oSite = oSMS.Get("SMS_Site")
		Set oParams = oSite.Methods_.Item("ImportMachineEntry").inParameters.SpawnInstance_()
		oParams.NetbiosName = sNetBiosName
		oParams.MACAddress = sMacAddress
		oParams.OverwriteExistingRecord = false

		On Error Resume Next
		Set oResult = oSite.ExecMethod_("ImportMachineEntry", oParams)
		If Err then
			PXE.LogTrace "Error importing machine entry: " & Err.Description & " (" & Err.Number & ")"
			Set oLastError = CreateObject("WbemScripting.SWbemLastError")
			PXE.LogTrace "Last WMI error: " & oLastError.Description
			Exit Function
		End if
		On Error Goto 0

		iResourceID = oResult.ResourceID
		PXE.LogTrace "Added new machine with ResourceID = " & iResourceID

	End if

	'//  Check if the computer is a member of the specified collection

	If bFound then

		' Build the query

		sQuery = "SELECT * FROM SMS_CM_RES_COLL_" & sCollection & " WHERE ResourceID = " & iResourceId

		' Process the query

		bFound = False
		Set oClients = oSMS.ExecQuery(sQuery)
		For each oClient in oClients
			bFound = true
			PXE.LogTrace "Machine is already in collection " & sCollection
			Exit For

	End If

	'//  If necessary, add the computer to the specified collection

	If not bFound then

		' Add the computer to the specified collection

		On Error Resume Next
		Set oCollection = oSMS.Get("SMS_Collection.CollectionID='" & sCollection & "'")
		If Err then
			PXE.LogTrace "Error retrieving collection " & sCollection & ": " & Err.Description & " (" & Err.Number & ")"
			Set oLastError = CreateObject("WbemScripting.SWbemLastError")
			PXE.LogTrace "Last WMI error: " & oLastError.Description
			Exit Function
		End if
		On Error Goto 0

		Set oNewRule = oSMS.Get("SMS_CollectionRuleDirect").SpawnInstance_()
		oNewRule.ResourceClassName = "SMS_R_System"
		oNewRule.RuleName = sNetBiosName
		oNewRule.ResourceID = iResourceID

		On Error Resume Next
		oCollection.AddMembershipRule oNewRule
		If Err then
			PXE.LogTrace "Error adding membership rule to " & sCollection & ": " & Err.Description & " (" & Err.Number & ")"
			Set oLastError = CreateObject("WbemScripting.SWbemLastError")
			PXE.LogTrace "Last WMI error: " & oLastError.Description
			Exit Function
		End if
		On Error Goto 0
		PXE.LogTrace "Added new membership rule to collection " & sCollection

	End if

	'//  Wait until an advertisement is seen.

	' Check for the advertisements

	Set oAdvertisement = oSMS.Get("SMS_Advertisement")
	i = 0
	bTrying = True
	Do While bTrying 

		Set oParams = oAdvertisement.Methods_("GetAdvertisements").inParameters.SpawnInstance_()
		oParams.ResourceID = iResourceID

		Set oResult = oAdvertisement.ExecMethod_("GetAdvertisements", oParams)
		For each sAdvert in oResult.AdvertisementIDs
			PXE.LogTrace "Found advertisement " & sAdvert
			bTrying = False

		i = i + 1
		If bTrying and i > 10 then
			PXE.LogTrace "Giving up after 30 seconds of checking for new advertisements."
			bTrying = False
		End if

		PXE.Sleep 3000


	PXE.LogTrace "Exiting PXEFilter.vbs"

End Function

BDD2007 PXE-Filter

The PXE-filter in BDD2007 isn’t the best, and there are a few good-to-know things that can be hard to find…

The script \Microsoft Deployment Toolkit\Scripts\PXEFilter.vbs have a few parameters at the top that you need to configure:

sProviderServer = "sccmserver.domain.com" ' FQDN of the SCCM-server
sSiteCode = "CS1" ' Your site-code
sNamespace = "root\sms\site_" & sSiteCode ' Do not change
sUsername = "" ' Keep this one blank if the WDS and SCCM are installed on the same machine
sPassword = "" ' Same as with sUsername
sCollection = "CS10000E" ' ID of the deployment role

Remember: Do not add user and pass when you are on the same machine.

To debug the script, set the following key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Tracing\WDSSERVER\EnableFileTracing to 1 and restart WDSServer
When you do, it will create a logile at %WinDir%\Tracing\WDSServer.LOG

If you need to add some debug-info in the script, add a line like this:

PXE.LogTrace "My little debug-thingy"

Then you will se the following line in WDSServer.LOG:

[5440] 15:34:11: [WDSPXE] [Microsoft.BDD.PXEFilter] My little debug-thingy

And when you get it to work, the WDSServer.LOG should look like this:

[6288] 15:34:07: [WDSPXE] [Microsoft.BDD.PXEFilter] About to run script
[1812] 15:34:07: [WDSPXE] [Microsoft.BDD.PXEFilter] PXEFilter.vbs - Processing request from MAC address = 00:11:22:33:44:55, IP address =, UUID = 11111111-1111-1111-1111-111111111111
[1812] 15:34:07: [WDSPXE] [Microsoft.BDD.PXEFilter] PXEFilter.vbs - Could not find machine with MAC address '00:11:22:33:44:55' or SMBIOS UUID '11111111-1111-1111-1111-111111111111'.
[1812] 15:34:07: [WDSPXE] [Microsoft.BDD.PXEFilter] PXEFilter.vbs - Added new machine with ResourceID = 46
[1812] 15:34:08: [WDSPXE] [Microsoft.BDD.PXEFilter] PXEFilter.vbs - Added new membership rule to collection CS10000E
[1812] 15:34:11: [WDSPXE] [Microsoft.BDD.PXEFilter] PXEFilter.vbs - Found advertisement CS120001

So what does the PXE-filter do?
1. Looks to see if the machine exist (via WMI to the SCCM-server)
2. If it exist, just exit the script. If not, create it.
3. Add it to the collection (Stated with the sCollection-setting)
4. Wait’s up to 15 seconds to see if there is an advertisment against the collection.
And then it’s done.

Note: I found this info when using SCCM2007 and BDD2007, might work with other versions…

HW-drivers with DriverMax

A small but powerful tool.

When you are creating images or creating scripts to deploy operating systems the drivers can be *”##&%! to extract / find.

This is a nice tool…

DriverMax is a new program which allows you to easily reinstall all your Windows drivers. No more searching for rare drivers on discs or on the web or inserting one installation CD after the other. Simply export all your current drivers (or just the ones that work ok) to a folder or a compressed file. After reinstalling Windows you will have everything in one place!


MD the new BDD

Microsoft is announcing the RC1 of the “new” SA named “Microsoft Deployment”

We are pleased to announce the RC1 release and new name for the fourth generation deployment Solution Accelerator, Microsoft Deployment. The current generation of automated deployment tools from Microsoft is increasingly unified; the same tools, utilities and products in many cases offer support and functionality for desktop and server deployment tasks. Following the trend of unified tools, the Business Desktop Deployment team has incorporated new functionality and guidance to support automated server deployment in addition to desktop deployment capabilities. This expanded feature set, with its guidance and ability to automate installation of Windows client and server operating systems – as well as applications – has effectively outgrown the current name, Business Desktop Deployment. Previous Beta releases have been using the code name “Deployment 4” to refer to Microsoft Deployment before the name was finalized.

Read more at blogs.technet.com/jasons/

Some of the nice features:

  • Windows Server 2003 deployments
  • LTI support for Windows Server 2008
  • Multiple task sequence templates (XP, Vista, Server…)
  • BDD 2007 and MD side-by-side upgrade
Written by Comments Off on MD the new BDD Posted in ConfigMgr Tagged with

Deployment 4 Beta 3 Released

The BDD team have announced that Deployment 4 (the code name for the next version of Business Desktop Deployment (BDD) 2007) has been released as BETA 3 and unifies the tools and processes required for desktop and server deployment into a common deployment console and collection of guidance. Previously referenced as BDD.Next and Windows Server Deployment (WSD), Deployment 4 adds integration with recently released Microsoft deployment technologies to create a single path for image creation and deployment, including:

* System Center Configuration Manager 2007 Operating System Deployment
* Windows Automated Installation Kit
* Windows Deployment Services with new multicast technology
* Application Compatibility Toolkit 5.0
* User State Migration Tool 3.0.1
* Windows Server 2008 Server Manager for automated server role definition (coming soon)

Richard Smith : Deployment 4 Beta 3 Released