I have been using different script and solutions to tattoo the registry during OSD with useful information. There was a question a while ago on Technet forum for a script that could be used to tattoo the registry with Task Sequence variables values it can be found here: http://social.technet.microsoft.com/Forums/en-US/configmanagerosd/thread/24cd277c-d8cb-4dad-a10e-a087a2e5a791/#7d11e483-83a4-4d97-9721-f6a359f6717f
After that I have been using it myself a couple of times to tattoo the client registry during OS deployments, rewrote it a bit and here it is:
I write some values in the Task Sequence which I the pick up in the script like Clientversion, TSVersion like this:
The script then simply picks up the Task Sequence variables you are interested in and writes it to the registry like below. It is then really simple to extend the HW inventory in Configuration Manager to include the newly created registry key and then you can create your own reports for when computer where installed and of course used to populate collections.
Then you can create a collection if all computers deployed with a specific version of the TS for instance and target it with updates.
The script will create a registry key for you under HKEY_Local_Machine\Software, just change the value in the script.
To implement it:
1. Modify the script to create a registry key with a name of your choice, strKeyPath = “SOFTWARE\CCMEXEC”
2. Create a package containing the script
3. Add the two task sequence variables I use above if you don’t edit the script. TSversion and Clientversion
4. Add Run command line step in the TS after the Setup Windows and Configuration Manager step( as we want to be in the installed OS) that runs the script.
Then you are ready to test the script.
It is really easy to add more variables to the script if you need to, here is the list of all available built in TS variables: http://technet.microsoft.com/en-us/library/hh273375.aspx
The script, can be downloaded in a text file here as well: Download
' Sample script to Tattoo the registry during a SCCM task seqeunce with usefull information
' Written by Jorgen@ccmexec.com
' Sample script to Tattoo the registry during a SCCM task seqeunce with usefull information
' Written by Jorgen@ccmexec.com
dim osd
dim oreg
dim strkeypath
Dim env
const HKEY_LOCAL_MACHINE = &H80000002
set env = CreateObject("Microsoft.SMS.TSEnvironment")
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
'Variables
'Main Registry Key path
strKeyPath = "SOFTWARE\CCMEXEC"
'Values
IntallDateTime = formatdatetime(date,2) & " " & formatdatetime(time,3)
AdvertisementID = env("_SMSTSAdvertID")
Organisation = env("_SMSTSOrgName")
TaskSequenceID = env("_SMSTSPackageID")
Packagename = env("_SMSTSPackageName")
MediaType = env("_SMSTSMediaType")
TSVersion = env("TSVersion")
ClientVersion = env("Clientversion")
MachineName = env("_SMSTSMachineName")
Installationmode = ("_SMSTSLaunchMode")
'Create the main Registry Key
oReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath
'Write Values to the Registry
Call writereg ("Installed Date", IntallDateTime)
Call writereg ("AdvertisementID",AdvertisementID)
Call writereg ("Organisation",Organisation)
Call writereg ("Task Sequence Name",Packagename)
Call writereg ("Media Type",MediaType)
Call writereg ("Task Sequence version",TSVersion)
Call writereg ("Client Version", ClientVersion)
Call writereg ("Computername", MachineName)
Call writereg ("Installation Type", Installationmode)
'----------- Write to registry ---------------
Function writereg(strValueName, strValue)
oReg.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue
End Function
I found this VERY helpful. I modified how it was execute slightly. We use MDT and I put it in the %deployshare% folder that we use for a few other scripts. Works great.
Thanks!!!!!
Hi
Do you also have an example on how to get this information from computers with the reporting feature in SCCM 2007?
I’m thinking about what to editing/type in the SMS_DEF.MOF and Configuration.MOF, then the query for the report to show this information for all computers?
So that we can run reports to see when the computers were deployed, what version of the task sequence it was deployed with and so on.
Thank you very much 🙂
will this work with SCCM 2007?
Yes, it works just fine with SCCM 2007
/Jörgen
I can see that all the TS variables are valid for SCCM 2007 and it worked there also 🙂 the only issue was that “Disable 64-bit file system redirection” enabled in TS does not seem to work. If we have redirection it works but then it goes to Wow6432Node.
Hi Jörgen
Is it possible to make all the clients register the IntallDateTime in the same format (DD.MM.YYYY HH:MM:SS)? The computers deployed have different regional settings so they are writing this information in different formats and that makes it very hard to sort the “Tattoo report” on the deployment time for computers. Thank you.
Hey Jörgen,
A bit old, but I have actually written recently a similar script to yours in PowerShell which gives you the choice to either tattoo information in the registry, WMI repository, or environment variable (or all at the same time). I leave the link here for the ones that are interested in it 🙂
http://powershelldistrict.com/osd-tattoo-powershell/
Hi Jörgen, First of all, thank you for your contribution for all of us.
I am a bit confused how I could apply this solution to my SCCM 2012 R2 environment.
Would be able to tell me where I should place this script on my Task sequence? Since I have a MDT integrated with my SCCM, the steps are different from yours and I dont know exactly before which step I should place the script.
Other question is, should I create a package with no Program?
What type of step should it be? would it be a “new task sequence variable” or a “run command line”
Thank you for your help in advance.
Eden Oliveira
Jörgen how are you?
To apply Script to tattoo the customer record during OSD does not need to run a command type Cscript.exe to run the command .vbs script?