Friday, April 3, 2009

Useful VB Script for sysprep ID String

This morning I was trying to figure out whether a server deployed was the correct image, and since they all almost look the same, the easiest way was to look at its sysprep ID string.

This would be pretty useful to have, and I’ll be including it in my next build of the server image. here’s the script:

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "SYSTEM\Setup"
strValueName = "OEMDuplicatorString"
objRegistry.GetMultiStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrValues

If IsNull(arrValues) Then
Wscript.Echo "This computer seems to have been installed from scratch."
Else
Wscript.Echo "This computer's Sysprep identification string is:" & VbCr & VbCr & arrValues(0)
End If



If you want to use it, just copy and paste this in a file, and save it as GetSysprepID.vbs , and run it: cscript GetSysprepID.vbs

It should give a result similar to this:




C:\Documents and Settings\lisa carr\Desktop>cscript getID.vbs 
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

This computer’s sysprep identification string is: W2K3_StdSvrTpl_102908

No comments:

Post a Comment

Please make your comment. (GMK)

Note: Only a member of this blog may post a comment.