Jump to content


Grubsy

Prompt for Asset Tag if it is not set in the BIOS during OSD

Recommended Posts

We have company property stickers on all machines which has a 6 digit asset number i.e. 001025

 

I set this in the BIOS of all our machines (Dell) and then use it as part of the computer name during OSD

 

I would like to add a step to check if this is set and if not (all new machines) prompt the user to enter it. I found an old topic that has some info on reading the asset tag, prompting if one isn't set and using it for the computer name

 

http://www.windows-noob.com/forums/index.php?/topic/2140-osd-using-vbs-for-machine-name-for-uknown-computers/

 

I am using the Dell CCTK to set other BIOS setting so I believe it would be a matter of using the following or something similar:

 

cctk.exe --asset=%NewAssetTag%

 

Currently I have the following steps:

 

Use Toolkit Package

Gather

Set Computer Name

 

So somehow I need to check if %AssetTag% doesn't begin with say 000, 001, or 002 and then prompt the use to enter a new asset and set it with the Dell CCTK

 

Any help would be greatly appreciated. Thanks in advance :)

Share this post


Link to post
Share on other sites

Here is what I have come up with so far. Seems to be working ok in initial testing:

 

I have commented out a few prompts I was using for testing so there is only one popup to enter the asset tag during the OSD task sequence.

 

I followed some of the guides here to set other BIOS settings and also integrate the Dell CCTK into my boot image

http://windowsmasher.wordpress.com/2013/01/21/sccm-2012-optimizing-dell-cctk-osd-actions-into-winpe/

'	Check-AssetTag.vbs
'
'	This script will check if the Asset Tag is set in the
'	BIOS. If not it will prompt the user for an Asset Tag
'	and then write it to the BIOS Asset Tag on Dell Machines
'
'	CCTK.exe and required files must be present in
'	%SYSTEMROOT%\System32

Dim WshShell
Dim colSMBIOS
Dim objComputer
Dim sNewAssetTag
Dim sTmp

Set WshShell = CreateObject("Wscript.Shell")
Set WshNetwork = CreateObject("Wscript.Network")
Set oShell = WScript.CreateObject( "Wscript.Shell" )
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colSMBIOS = objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure")

For Each Asset in colSMBIOS
	sTmp = trim(Asset.SMBIOSAssetTag)
Next

For a = 1 to Len(sTmp)
	c = Mid(sTmp,a,1)
	If c >= "0" And c <= "9" Then
		sNewAssetTag = sNewAssetTag + c
	End If
Next

If Len(sNewAssetTag) = 6 And Left(sNewAssetTag,2) = "00" Then
	' Exit if the Asset Tag is already set
	' wscript.echo "The Asset Tag is already set to : "& sNewAssetTag
Else
	Do While (Len(sNewAssetTag) <> 6)
		sTmp = InputBox("Please enter the PC's Asset Number.  This must be a 6 digit number only i.e. 001045. If you can't find or are unsure of the PC's Asset number please contact IT before proceeding.")

		sNewAssetTag = ""
		For a = 1 to Len(sTmp)
			c = Mid(sTmp,a,1)
			If c >= "0" And c <= "9" Then
				sNewAssetTag = sNewAssetTag + c
			End If
		Next
	Loop

	sSystemRoot = oshell.expandenvironmentStrings("%SYSTEMROOT%")

	' This is the Dell BIOS setting we want to set
	sBIOSSetting = "--asset="
	' Build the command that needs to be run
	sSetBIOSCommand = sSystemRoot & "\System32\cctk.exe " & sBIOSSetting & sNewAssetTag
	' Display the command that is about to run
	' wscript.echo sSetBIOSCommand
	' Run the command to set the Asset Tag
	oShell.Run sSetBIOSCommand
End If

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.