EOLmodels = Array("Latitude D630","Latitude E4300","Latitude E4310","Latitude E6320","Latitude E6500","Latitude E6510","Latitude E6520","Latitude E7440","OptiPlex 745","OptiPlex 755","OptiPlex 760","OptiPlex 780","OptiPlex GX620",_ "Precision M4400","Precision M4500","Precision M4600","Precision M4700","Precision M6600","Precision WorkStation 380","Precision WorkStation 390","Precision WorkStation T3400","Precision WorkStation T3500","Precision WorkStation T5500") For Each lobjitem in lcolmodel lstrModel = lobjitem.model Next for each x in EOLmodels select Case lstrModel Case "OptiPlex 780" WScript.Echo "We found it" lstrValue = "28-02-2013" end select next
Er det ikke muligt at lave en Select Case på denne måde - altså med et mellemrum? "OptiPlex 780" Jeg får ihvertfald ikke nogen melding om at det er fundet.
EOLmodels = Array("Latitude D630","Latitude E4300","Latitude E4310","Latitude E6320","Latitude E6500","Latitude E6510","Latitude E6520","Latitude E7440","OptiPlex 745","OptiPlex 755","OptiPlex 760","OptiPlex 780","OptiPlex GX620","Precision M4400","Precision M4500","Precision M4600","Precision M4700","Precision M6600","Precision WorkStation 380","Precision WorkStation 390","Precision WorkStation T3400","Precision WorkStation T3500","Precision WorkStation T5500") For Each lobjitem in lcolmodel lstrModel = lobjitem.model Next for each x in EOLmodels if InStr(lstrModel,x) <> 0 then select Case lstrModel Case "OptiPlex 780" WScript.Echo "We found it" lstrValue = "28-02-2013" end select end if next
Dette skal med: Set objWMIServiceComputerSystem = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set lcolmodel = objWMIServiceComputerSystem.ExecQuery("SELECT * FROM Win32_ComputerSystem")
Jeg er ikke så skrap til VBscript, men hvis jeg laver dette:
For Each lobjitem in lcolmodel lstrModel = lobjitem.model Next WScript.Echo lstrModel
Det har ikke voldt mig nogen problemer at bruge den. Dette er for at finde min computermodel.
dim lcolmodel Set objWMIServiceComputerSystem = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2") Set lcolmodel = objWMIServiceComputerSystem.ExecQuery("SELECT * FROM Win32_ComputerSystem") For Each lobjitem in lcolmodel lstrModel = lobjitem.model Next WScript.Echo lstrModel Set lcolmodel = Nothing
Tror egentlig også at jeg bare kunne læse registreringsdatabasen: HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS\SystemProductName
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.