/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Script error, need HELP ASAP PLEASE!

07/13/2017 1430 views
I have the following script that I found on the net. I'm trying to get it to work but I do not know vb that well and I'm completely stumped! Please help! I've highlighted the text at the bottom of the script where I am getting the error. 

' DELL BIOS UPGRADES
' Dell Inc 2008
' For new BIOS revisions you can download them from ftp.dell.com/bios
' Or for individual systems use the download menus on support.dell.com
' Modify the Case statement below to reflect newer revisions
On Error Resume Next
DlgTitle = "IT Department"
Set WshShell = CreateObject("Wscript.Shell")
Set WshNet = CreateObject("Wscript.Network")
PathToScript = Left(WScript.ScriptFullName,(Len(WScript.ScriptFullName) - (Len(WScript.ScriptName) + 1)))
CompName = WshNet.ComputerName
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set wmi = objLocator.ConnectServer(CompName, "root\cimv2",,,,,128)
For Each Instance in wmi.ExecQuery("Select * From Win32_ComputerSystem",,48)
Model = Instance.Model
Next
For Each Instance in wmi.ExecQuery("Select * From Win32_SystemEnclosure",,48)
ServTag = Instance.serialnumber
Next
For Each Instance in wmi.ExecQuery("Select * From Win32_Bios",,48)
BIOSRev = Instance.SMBIOSBIOSVersion
Next
Model = Trim(Model)
Select Case Model

Case "Latitude 5285" : ExeToRun = "Latitude_5285_1.1.7.EXE" : NewBIOSVersion="A06" 
Case "Latitude 7480" : ExeToRun = "Latitude_7x80_1.5.2.EXE" : NewBIOSVersion="A05" 
Case "Latitude E4310" : ExeToRun = "Latitude_E4310_A15.EXE" : NewBIOSVersion="A06" 
Case "Latitude E5540" : ExeToRun = "E5540A18.EXE" : NewBIOSVersion="A04" 
Case "Latitude E5570" : ExeToRun = "Latitude_E5x70_Precision_3510_1.15.4.EXE" : NewBIOSVersion="A04" 
Case "Latitude E6320" : ExeToRun = "Latitude_E6320_A20.EXE" : NewBIOSVersion="A09" 
Case "Latitude E6330" : ExeToRun = "E6330A19.EXE" : NewBIOSVersion="A08" 
Case "Latitude E6410" : ExeToRun = "Latitude_E6410_E6410ATG_A17.EXE" : NewBIOSVersion="A08" 
Case "Latitude E6420" : ExeToRun = "Latitude_E6420_E6420ATG_A24.exe" : NewBIOSVersion="A10" 
Case "Latitude E6430" : ExeToRun = "E6430A21.EXE" : NewBIOSVersion="A02" 
Case "Latitude E6430s" : ExeToRun = "6430SA19.EXE" : NewBIOSVersion="A02"
Case "Latitude E6510" : ExeToRun = "Latitude_E6510_A17.EXE" : NewBIOSVersion="A02"
Case "Latitude E7240" : ExeToRun = "E7240A21.EXE" : NewBIOSVersion="A02"
Case "Latitude E7250" : ExeToRun = "E7250A16.Exe" : NewBIOSVersion="A02"
Case "Latitude E7440" : ExeToRun = "E7440A21.EXE" : NewBIOSVersion="A02"
Case "Latitude E7450" : ExeToRun = "E7450A16.EXE" : NewBIOSVersion="A02"
Case "Latitude E7470" : ExeToRun = "Latitude_E7x70_1.16.4.EXE" : NewBIOSVersion="A02"
Case "OptiPlex 790" : ExeToRun = "O790-A19.exe" : NewBIOSVersion="A08" 
Case "OptiPlex 990" : ExeToRun = "O990-A20.exe" : NewBIOSVersion="A09" 
Case "OptiPlex 7040" : ExeToRun = "OptiPlex_7040_1.6.5.exe" : NewBIOSVersion="A11" 
Case "OptiPlex 7040 AIO" : ExeToRun = "OptiPlex_7440_1.8.2.exe" : NewBIOSVersion="A11" 
Case "OptiPlex 9020" : ExeToRun = "O9020A20.EXE" : NewBIOSVersion="1.1.11" 
Case "OptiPlex 9020M" : ExeToRun = "9020MA14.EXE" : NewBIOSVersion="A03" 
Case "OptiPlex 9030 AIO" : ExeToRun = "OptiPlex_9030_AIO_A17.EXE" : NewBIOSVersion="2.0.12" 
Case "Precision 5510" : ExeToRun = "Precision_5510_1.2.25.EXE" : NewBIOSVersion="A04"
Case "Precision 5520" : ExeToRun = "Precision_5520_1.3.4.EXE" : NewBIOSVersion="A09"
Case "Precision 7520" : ExeToRun = "Precision_7x20_1.6.0.EXE" : NewBIOSVersion="A08"
Case "Precision M4600" : ExeToRun = "Precision_M4600_A17.EXE" : NewBIOSVersion="A08"
Case "Precision M4700" : ExeToRun = "M4700A17.EXE" : NewBIOSVersion="A08"
Case "Precision M6800" : ExeToRun = "M6800A19.EXE" : NewBIOSVersion="A08"
Case "Precision T3600" : ExeToRun = "T3600A15.EXE" : NewBIOSVersion="A08"
Case "Precision T3610" : ExeToRun = "T3610A14.EXE" : NewBIOSVersion="A08"
Case "Precision Tower 3620" : ExeToRun = "WS340A07.EXE" : NewBIOSVersion="A07" 
Case Else : ExeToRun = "NA"
End Select 
If ExeToRun = "NA" Then 
MsgBox "We do not currently provide a BIOS upgrade for a " & Model & vbcrlf & vbcrlf & "If this is an older model system, please excess the equipment.",0,DlgTitle 
Wscript.Quit(1) 
ElseIf BIOSRev = NewBIOSVersion Then 
MsgBox "The current BIOS[" & BIOSRev & "] for this " & Model & " is up-to-date and does not require an upgrade.",0,DlgTitle 
Wscript.Quit(1) 
End If 
ExeStr = PathToScript & "\" & ExeToRun 
WshShell.Run Chr(34) & ExeStr & Chr(34) & "-NOREBOOT" & Chr(34), 1, False 
Wscript.Quit(0)
0 Comments   [ + ] Show comments

Comments



Community Chosen Answer

1
Replace this line:
WshShell.Run Chr(34) & ExeStr & Chr(34) & "-NOREBOOT" & Chr(34), 1, False

With this:
WshShell.Run Chr(34) & ExeStr & Chr(34) & " -NOREBOOT", 1, False

chr(34) is an ASCII code for " sign, so you command looks like:
"C:\Some_Path\ExeName"-NOREBOOT".
I believe that the correct syntax is:
"C:\Some_path\Exename" -NOREBOOT

To make sure that the command line is OK, you can add MsgBox Chr(34) & ExeStr & Chr(34) & " -NOREBOOT"
before WshShell.Run.
Answered 07/14/2017 by: rad33k
Fourth Degree Brown Belt

All Answers

0

Seems to work fine for me.

Answered 07/14/2017 by: akmagnum
Red Belt

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ