Thursday, 2 March 2017

ConfigMgr OSD - use MDT without using MDT

The title may not make much sense but please read on about a recent customer requirement.

Customer requirement

In the task sequence, set the computer name to match the service tag

Solution

Easy - use the OSDComputerName variable with a value of %SerialNumber% (or was it that easy?)

Problem Statement


How does the %SerialNumber% value get populated in this case? This is straightforward if I'm using MDT integration as I can use the Gather step. However, the customer does not have MDT integrated and this would take a few weeks to organize with a strict change request procedure.
So what do I do?


Solution (revised)

Do I actually need MDT integrated or do I just need some MDT files?

I had a word with @ncbrady from @WindowsNoob and we came up with a plan. I installed MDT on a laptop and created a deployment share.



I figured that these files were all that I needed - only 45MB. I copied the files to my content source location and created an MDT Gather package (with no program).
Then I configured the TS as shown in the screenshots.



First I ran ZTIGather.wsf with this command

Cmd.exe /c cscript.exe .\Scripts\ZTIGather.wsf /debug:TRUE

This was to "discover" the service tag.



The next step was to set the hostname to match the serial number (service tag).

Unfortunately the task sequence failed:

"Gathering complete, but no INI file found” with an error code of 0x00001F40



On examining the smsts.log file the hostname was in fact set to the service tag, even though the task sequence failed. Happy days. I was just missing a customsettings.ini file. I manually created a default .ini file and copied it to the scripts folder.

[Settings]
Priority=Default
Properties=MyCustomProperty

[Default]
OSInstall=Y
SkipCapture=YES
SkipAdminPassword=NO
SkipProductKey=YES


That did it - SUCCESS.
Thanks for the assistance Niall.

Until next time.......

Edit #1:

Jörgen Nilsson has contacted me to say that only a few of the MDT files are actually required (less than 800KB). Here they are:


Thanks Jörgen.

Edit #2:


I've had some feedback about other ways to set the computer name to the service tag without using MDT. Thanks for that. However, the whole point of this post was to show how you can achieve MDT functionality without actually integrating MDT with ConfigMgr.


After all, the title is "Use MDT without using MDT".





5 comments:

  1. very nice and creative way to do perform this task without use of MDT.

    Need is mother of ivention :)

    ReplyDelete
  2. Hi Gerry , you could also achieve this with PS. Something i mentioned here http://apppackagetips.blogspot.co.uk/2016/04/sccm-osd-name-pc-simple-powershell.html

    $Serial = Get-WmiObject -Query 'select IdentifyingNumber from Win32_ComputerSystemProduct' -Namespace 'Root\cimv2'
    $Model = Get-WmiObject -Query 'select Name from Win32_ComputerSystemProduct' -Namespace 'Root\cimv2'
    $SerialNo = $Serial.IdentifyingNumber.SubString(3)
    $TS = New-Object -ComObject "Microsoft.SMS.TSEnvironment"
    $TS.Value("OSDComputername") = 'LOC-' + $SerialNo
    ## Example Locatio would be LOC-54477X4
    $TS.Value("XModel") = $Model.Name

    ReplyDelete