Getting OSDCOMPUTERNAME from an Asset Database
Hi,
This probably will be easy to answer, but i figured i'd throw it out there.
We have an asset mgmt database that contains information like: Domain, ComputerName, SerialNumber, Barcode. At our company we rename our computers the barcoded tag on the asset. So my question is:
Can i run a script that during the task sequence, goes out and connects to the sql database, queries based on Serial#, loads in the variable information i need (i.e. OU, Domain, ComputerName) then renames and joins appropriately.
I guess what i am really trying to find out is where this would happen in the task sequence.
Here's my pseudocode
Open connection to database
Query database matching on serial number and store in recordset
Set OSD Variable
set env = CreateObject("Microsoft.SMS.TSEnvironment")
env("OSDComputerName") = rs("ComputerName")
May 25th, 2010 3:03pm
OSDCOMPUTERNAME and the the other task sequence variables that control the OU and domain membership end up populating the appropriate locations in your unattended setup file (sysprep.inf for XP or unattend.xml for Win7) so that Windows mini-setup can use
them. Thus, you must run this and populate the variables before the Setup Windows and ConfigMgr task during the WinPE portion of the TS.Jason | http://myitforum.com/cs2/blogs/jsandys | http://blogs.catapultsystems.com/jsandys/default.aspx | Twitter @JasonSandys
Free Windows Admin Tool Kit Click here and download it now
May 25th, 2010 4:51pm
The easiest way is to use the existing database connection features that MDT 2010 Zero Touch extends configmgr with.... Then you don't even have to run a script, just edit the settings package...
May 25th, 2010 5:15pm
Everytime I try running a VBScript in the task sequnce, i receive the following error:
"Windows Could not parse or process the unattend answer file for pass.
Here's my script:
<job id="BuildVars">
<script language="VBScript">
'//----------------------------------------------------------------------------
'//
'// Global constant and variable declarations
'//
'//----------------------------------------------------------------------------
Option Explicit
Dim env
Dim strComputer
Dim objWMIService
Dim biosVars
Dim strSerial
Dim objBios
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set biosVars = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery ("select * from Win32_BIOS")
For Each objBios in biosVars
strSerial = objBios.SerialNumber
Next
SET env = CreateObject("Microsoft.SMS.TSEnvironment")
env("OSDComputerName") = "TPC" & strSerial
env("OSDDomainName") = "AMERICA"
env("OSDdomainOUName") = "LDAP://OU=Thin Client,OU=Windows 7,OU=Workstations,DC=america,DC=apci,DC=com"
</script>
</job>
The sequence where this executes is:
POSTINSTALL GROUP
-Gather -Apply Windows Settings -Apply Network Settings -BuildVars (This is the script above) -Configure -Setup Windows and Configuration Mgr
Anybody with Thoughts? If i remove this script, it runs fine.
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2010 8:23pm
Sorry, This worked fine. Had a typo in the vbscript.
May 26th, 2010 9:31pm
Did you ever get a final version of this script going housertc?
I'm trying to do exactly this - and have the task sequence look into a SQL database, and use the asset tag (servicenumber) to look up a computername and OU to assign to the machine during the build.
Interested to know if that was something you got going and if you can post it here.
Thanks
Robin
Free Windows Admin Tool Kit Click here and download it now
July 6th, 2011 5:45am
No need to write a script for that... SQL database access is built into MDT...
Check Part 18 and 19 of the MDT 2010 Lite Touch - Unleashed Video series
http://www.deploymentresearch.com/Videos/MDT2010LiteTouchUnleashedVideos.aspx
/ JohanRegards / Johan Arwidmark Twitter: @jarwidmark Blog: http://www.deploymentresearch.com FB: www.facebook.com/deploymentresearch
July 6th, 2011 4:43pm