ScottGill
Posts: 31
Score: 0 Joined: 3/1/2007 Status: offline
|
I'm working on a system similar to BDD/ZTI for our techs to use. Unfortunately, the role based system in SCCM is not going to work correctly in our environment as we don't really have roles so much as users requesting whatever software they want and getting it (that's a whole other story). Anyway, I've built a table in the SCCM database and a web based front-end for our techs to use to image new machines entering such variables as which image to use, the machine name, asset tag, and what applications to install. I wrote a VBScript to put the basic information into the database when the OSD process starts for new machines (Service Tag, CPU and other info)... My problem is that this script works perfectly in Windows, but I cannot for the life of me get it to work correctly in WinPE. The really difficult part is that the script is not throwing any kind of errors so I don't know what's wrong. Below is the script I'm using... Thanks for any help. P.S. The actual query containing the real data is at the bottom, commented out b/c I was trying to see if there may have been some kind of variable issue. quote:
Dim env, strSerialNumber, sccm Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set colSMBIOS = objWMIService.ExecQuery("Select * from Win32_SystemEnclosure") For Each objSMBIOS in colSMBIOS strSerialNumber = objSMBIOS.SerialNumber Next Set sccm = CreateObject("ADODB.Connection") sccm.ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;User ID=sccm;password=<password>;Initial Catalog=<database>;Data Source=<server>" sccm.Open strQuery = "INSERT INTO Image_Staging (Name, Serial, ProcType, ProcDataWidth, Model, Memory, OS, Marked) VALUES ('5555555', '5555555', 'Intel', 64, 'Optiplex 755', 4000000000, 'GD100001', 0)" sccm.execute(strQuery) Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem",,48) For Each objItem in colItems strModel = objItem.Model strMemory = objItem.TotalPhysicalMemory Next Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor",,48) For Each objItem in colItems strProcCaption = objItem.Caption strProcDataWidth = objItem.DataWidth Next If Left(strProcCaption, 5) = "AMD64" Then strProcType = "AMD64" Else strProcType = "Intel" End If If strProcType = "AMD64" Then ImgID = "GD10005F" ElseIf strProcType = "Intel" AND strMemory > 3000000000 Then ImgID = "GD100067" ElseIf strProcType = "Intel" AND strMemory < 3000000000 Then ImgID = "GD100063" End If SET env = CreateObject("Microsoft.SMS.TSEnvironment") env("ImgID") = ImgID 'strQuery = "INSERT INTO Image_Staging (Name, Serial, ProcType, ProcDataWidth, Model, Memory, OS, Marked) VALUES ('" & strSerialNumber & "', '" & strSerialNumber & "', '" & strProcType & "', " & strProcDataWidth & ", '" & strModel & "', " & strMemory & ", '" & ImgID & "', 0)" 'sccm.execute(strQuery)
< Message edited by ScottGill -- 7/3/2008 7:12:55 PM >
|