Vous êtes sur la page 1sur 8

Daniel Grhns

daniel.grahns@atea.se

2012-06-08

MDT 2012
http://blogs.technet.com/b/benhunter/archive/2007/03/17/understanding-bdd-ruleprocessing.aspx

ZTIGather
To give an option in naming convention to differ from Laptops and Desktops when we install Slates I made changes to ZTIGather Changes made to ZTiGather.wsf are highlighted in red In Function GetAssetInfo:
'//-------------------------------------------------------------------------'// Function: GetAssetInfo() '// Purpose: Get asset information using WMI '//-------------------------------------------------------------------------Function GetAssetInfo Dim bIsPortable, bIsLaptop, bIsDesktop, bIsServer, bOnBattery, bFoundBattery, bFoundAC Dim sAssetTag, sSerialNumber, sMake, sModel, sProduct, sUUID, sMemory, sArchitecture, sProcessorSpeed, sCapableArchitecture Dim objResults, objInstance Dim i Dim bisX64, bIsUEFI oLogging.CreateEntry "Getting asset info", LogTypeInfo ' Get the SMBIOS asset tag from the Win32_SystemEnclosure class Set objResults = objWMI.InstancesOf("Win32_SystemEnclosure") bIsPortable = false bIsLaptop = false bIsDesktop = false bIsServer = false For each objInstance in objResults If objInstance.ChassisTypes(0) = 12 or objInstance.ChassisTypes(0) = 21 then ' Ignore docking stations Else If not IsNull(objInstance.SMBIOSAssetTag) then sAssetTag = Trim(objInstance.SMBIOSAssetTag) End if Select Case objInstance.ChassisTypes(0) Case "8" bIsPortable = true Case "9", "10", "11", "12", "14", "18", "21" bIsLaptop = true Case "3", "4", "5", "6", "7", "15", "16"

Daniel Grhns

daniel.grahns@atea.se
bIsDesktop = true Case "23" bIsServer = true Case Else ' Do nothing End Select End if

2012-06-08

And longer down in the same function:


oEnvironment.Item("AssetTag") = sAssetTag oEnvironment.Item("SerialNumber") = sSerialNumber oEnvironment.Item("Make") = sMake oEnvironment.Item("Model") = sModel oEnvironment.Item("Product") = sProduct oEnvironment.Item("UUID") = sUUID oEnvironment.Item("Memory") = sMemory oEnvironment.Item("Architecture") = sArchitecture oEnvironment.Item("ProcessorSpeed") = sProcessorSpeed oEnvironment.Item("CapableArchitecture") = sCapableArchitecture oEnvironment.Item("IsPortable") = oUtility.ConvertBooleanToString(bIsPortable) oEnvironment.Item("IsLaptop") = oUtility.ConvertBooleanToString(bIsLaptop) oEnvironment.Item("IsDesktop") = oUtility.ConvertBooleanToString(bIsDesktop) oEnvironment.Item("IsServer") = oUtility.ConvertBooleanToString(bIsServer) oEnvironment.Item("IsUEFI") = oUtility.ConvertBooleanToString(bIsUEFI) oEnvironment.Item("IsOnBattery") = oUtility.ConvertBooleanToString(bOnBattery)

CustomSettings.ini
[IdentifyComputer] Section will call a stored procedure and write to the database [CSettings] Section will read the data from the database Add this to customsettings.ini: [Settings] Priority=CPackages, CApps, CAdmins, CRoles, Locations, LSettings, LPackages, LApps, LAdmins, LRoles, MMSettings, MMPackages, MMApps, MMAdmins, MMRoles, RSettings, RPackages, RApps, RAdmins, IdentifyComputer,CSettings,Default,Model Properties=MyCustomProperty [IdentifyComputer] SQLServer=<SEVERNAME> Database=Deployment Netlib=DBNMPNTW SQLShare=DeploymentShare$ StoredProcedure=IdentifyComputer Parameters=UUID,SerialNumber,MacAddress, IsPortable, IsLaptop, IsDesktop

Daniel Grhns

daniel.grahns@atea.se

2012-06-08

[CSettings] SQLServer=<SERVERNAME> Database=Deployment Netlib=DBNMPNTW SQLShare=DeploymentShare$ Table=ComputerSettings Parameters=UUID, AssetTag, SerialNumber, MacAddress ParameterCondition=OR

Stored Procedure
Edit @NewName variable and use the prefix you want, then run this code in SQL Management Studio, this will create the stored procedure.

USE [Deployment] GO /****** Object: StoredProcedure [dbo].[IdentifyComputer] 06/08/2012 08:52:21 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE [dbo].[IdentifyComputer] @UUID VARCHAR(50), @SerialNumber VARCHAR(50), @MacAddress CHAR(17), @IsPortable VARCHAR(50), @IsLaptop VARCHAR(50), @IsDesktop VARCHAR(50)

Script Date:

Daniel Grhns
/* @Make VARCHAR(50), */ /* @Model VARCHAR(50) */ AS

daniel.grahns@atea.se

2012-06-08

DECLARE @Cnt INT, @Prefix VARCHAR(50), @Sequence INT, @NewName VARCHAR(50), @ID INT, @Chassi VARCHAR(50), @NewNameDate VARCHAR(50) SET NOCOUNT ON /* See if there is an existing record for this machine */ SELECT @Cnt=COUNT(*) FROM ComputerIdentity WHERE MacAddress = @MacAddress /* No record? IF @Cnt = 0 BEGIN /* Create a new machine name */ BEGIN TRAN IF @IsPortable = 'True' Begin SET @Chassi = 'PO-' End IF @IsLaptop = 'True' Begin SET @Chassi = 'LT-' End IF @IsDesktop = 'True' Begin SET @Chassi = 'DT-' End SELECT @ID = MAX(ID)+1 FROM ComputerIdentity SET @Sequence = @ID SET @NewName = 'YOURPREFIX Change thistext' + @Chassi + Right('00000'+LTrim(Str(@Sequence)),5) Set @NewNameDate = @NewName + ' (' + convert(varchar, getdate(), 120) + ')' /* Insert the new record */ INSERT VALUES INSERT OSInstall) VALUES INTO ComputerIdentity (Description,MacAddress,UUID,SerialNumber) (@NewNameDate,@MacAddress,@UUID,@SerialNumber) INTO Settings (Type, ID, OSDComputerName, OSDInstallSilent, ('C',@@IDENTITY, @NewName, '1', 'Y') Add one. */

COMMIT TRAN

Daniel Grhns
END /*

daniel.grahns@atea.se

2012-06-08

Return the record as the result set */

SELECT * FROM ComputerIdentity WHERE MacAddress = @MacAddress

MDT Bootimage
There is a bug in the first release of MDT 2012 that will make it impossible to write to the database without making changes to it (this will be fixed in update1). http://www.deploymentresearch.com/Blog/tabid/62/EntryId/62/Cannot-call-SQL-StoredProcedures-from-MDT-2012-generated-WinPE-4-0-boot-image.aspx We need to add some files from a windows 8 installation and add them to X:\Program Files\Common Files\System\Ole DB\en-US Files: msdasqlr.dll.mui oledb32r.dll.mui sqloledb.rll.mui sqlxmlx.rll.mui You can use Extra Directory to add the files:

Daniel Grhns

daniel.grahns@atea.se

2012-06-08

Update the deploymentshare after making the changes:

Daniel Grhns

daniel.grahns@atea.se

2012-06-08

MDT Database

Daniel Grhns

daniel.grahns@atea.se

2012-06-08

Vous aimerez peut-être aussi