Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Script with Exit Code options SCCM


Recommended Posts

Posted

Hi,

 

I want to make a script that will do something different depending on the edit code

 

A. biospassword1.exe - if the exit code is 1 clear the exit code so SCCM doesnt know about it, then go to step B then go to step C

B. biospassword2.exe - When run go to step C

C. ConfigureBios.exe

 

Any thoughts please?

 

Thanks

Posted
SCCM can run .bat and VBS scripts no problem. It can run pretty much anything.

 

It can also call the installers directly.

 

So if I understand you right:

 

Set WshShell = CreateObject("WScript.Shell") 

returncode = WshShell.Run("biospassword1.exe")

If returncode = 1 Then 
 	WshShell.Run("biospassword2.exe")
WshShell.Run("ConfigureBios.exe")
WScript.Quit(0) 
else

End If
WScript.Quit(returncode) 

 

It'll fire off exeA, "If" that fails (with code 1), it'll run the other two exe's, then exit with a success code?

 

Shouldn't it still exit with an error if 2nd exes fail though?

 

(Can't really test it without the exes etc though, so might not work :( )

 

Steve

  • Thanks 1
Posted

Basically run Step A, If its exit code 1 run B & C If its Code 0 run step C without B

 

I could give the .exe but they are configured specific for these Dell clients and will reset your BIOS password and reconfigure the setting.

 

Thanks

Posted
Basically run Step A, If its exit code 1 run B & C If its Code 0 run step C without B

 

I could give the .exe but they are configured specific for these Dell clients and will reset your BIOS password and reconfigure the setting.

 

Thanks

 

Ah, try this one then:

 

Set WshShell = CreateObject("WScript.Shell") 

returncode = WshShell.Run("biospassword1.exe")

If returncode = 1 Then 
 	WshShell.Run("biospassword2.exe")
WshShell.Run("ConfigureBios.exe")
WScript.Quit(0) 
elseif returncode = 0 Then
WshShell.Run("ConfigureBios.exe")
End If
WScript.Quit(returncode)

 

Only thing is do you want it to still fail, and return codes if 2nd+ exe go wrong? or only on first one?

 

Steve

Posted

If an exit code 1 comes up, and biospassword2.exe & ConfigureBios.exe run ok, i dont want SCCM to know about exit code 1.

 

I need both biospassword1.exe and biospassword2.exe as some machines out there dont have bios passwords set.

 

thanks again

Posted
If an exit code 1 comes up, and biospassword2.exe & ConfigureBios.exe run ok, i dont want SCCM to know about exit code 1.

 

I need both biospassword1.exe and biospassword2.exe as some machines out there dont have bios passwords set.

 

thanks again

 

What I mean is currently in my script

 

If returncode = 1 Then 
 	WshShell.Run("biospassword2.exe")
WshShell.Run("ConfigureBios.exe")
WScript.Quit(0) 

 

If it returns 1, it'll run the 2 exe's then force exit script with 0 (aka tells SCCM all is good). However it'll force exit on 0 even if biospassword2.exe bombs etc, as it's still telling it it exited ok.

 

Did you want it to actually return the real codes from 2nd/3rd exe?

 

Steve

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...