+ Post New Thread
Results 1 to 10 of 10
Scripts Thread, Script with Exit Code options SCCM in Coding and Web Development; Hi, I want to make a script that will do something different depending on the edit code A. biospassword1.exe - ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,940
    Thank Post
    886
    Thanked 1,693 Times in 1,472 Posts
    Blog Entries
    12
    Rep Power
    447

    Script with Exit Code options SCCM

    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

  2. #2

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,940
    Thank Post
    886
    Thanked 1,693 Times in 1,472 Posts
    Blog Entries
    12
    Rep Power
    447
    Anyone please?

  3. #3

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Thoughts as in code? Does SCCM just run vbs/BAT? Never really used SCCM, but can help on the code side if it is

    Steve

  4. #4

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,940
    Thank Post
    886
    Thanked 1,693 Times in 1,472 Posts
    Blog Entries
    12
    Rep Power
    447
    SCCM can run .bat and VBS scripts no problem. It can run pretty much anything.

    It can also call the installers directly.

  5. #5

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by FN-GM View Post
    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:

    Code:
    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

  6. Thanks to Steve21 from:

    FN-GM (9th September 2012)

  7. #6

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,940
    Thank Post
    886
    Thanked 1,693 Times in 1,472 Posts
    Blog Entries
    12
    Rep Power
    447
    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

  8. #7

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by FN-GM View Post
    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:

    Code:
    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

  9. #8

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,940
    Thank Post
    886
    Thanked 1,693 Times in 1,472 Posts
    Blog Entries
    12
    Rep Power
    447
    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

  10. #9

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,694
    Thank Post
    335
    Thanked 515 Times in 483 Posts
    Rep Power
    179
    Quote Originally Posted by FN-GM View Post
    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

    Code:
    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

  11. #10

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,940
    Thank Post
    886
    Thanked 1,693 Times in 1,472 Posts
    Blog Entries
    12
    Rep Power
    447
    Im with you now

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

    Thanks

SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 5
    Last Post: 29th April 2010, 12:02 PM
  2. help with simple code
    By greguk in forum Coding
    Replies: 2
    Last Post: 20th July 2008, 05:40 PM
  3. VPN connection with internet connection option
    By FN-GM in forum Wireless Networks
    Replies: 6
    Last Post: 29th December 2007, 07:19 PM
  4. DBATTACH exit code
    By ajbritton in forum MIS Systems
    Replies: 0
    Last Post: 24th November 2006, 11:31 AM
  5. Run script with elevated permissions
    By ajbritton in forum Windows
    Replies: 3
    Last Post: 9th August 2006, 02:04 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •