Jump to content

Recommended Posts

Hey guys.

So I'm creating an auto-run USB Drive for the guys in my shop to further help automate the update/re-image process. I'm a little rusty on my VB. Here's my code in it's current state:

x=MsgBox("Do not be afraid, vital software update is in progress. Please direct any errors to your System Administrator",0, "Derek's Auto Update")
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\updates\Firefox Setup Stub 25.0.1" 
d=MsgBox("Is the Firefox installation Complete",4, "I have a question for you.")
if d=vbYes then
e=MsgBox("Please download the installer from http://mozilla.org",,"I'm sorry...")
else
f=MsgBox("Excellent. Please click OK for the next installer.",, "Success!")
End If

PAUSE
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\updates\lenovographics.exe" 
PAUSE


a=MsgBox("Was there any errors during this update?",4, "I have a question for you.")
if a=vbYes then
b=MsgBox("Please send a detailed message to admin@work.com of any errors that occured",, "I'm sorry...")
else
c=MsgBox("Excellent. Thank you for your participation and cooperation.",, "Success!")
End If

My ultimate goal is this:

  • I'm not sure of the syntax to do this, but I'd like to keep the installer files on the USB drive rather than having to copy them over to the C:\ drive then run the installer.
  • I'm wanting to have this all fully automated. Once the user completes an installation (for example: Firefox), have a MsgBox pop up "did it complete?" If yes = open method z = next installer. The idea to have it all a nested IF/THEN.

Any advice is always appreciated. Thanks gang!

Link to comment
Share on other sites

  • 4 weeks later...


@echo off

color 2

"C:\updates\Firefox Setup Stub 25.0.1"

echo Press any key when Firefox is done installing.

pause

"C:\updates\lenovographics.exe"

SET /P ANSWER=Did 2 programs install correctly [y/n]?

echo You chose: %ANSWER%

if /i {%ANSWER%}=={y} (goto :yes)

if /i {%ANSWER%}=={yes} (goto :yes)

goto :no

:yes

echo You pressed yes! - Excellent. Thank you for your participation and cooperation

exit /b 0

:no

echo You pressed no! Try this Program once more

echo THEN Please send a detailed message to admin@work.com

echo of any errors that occured

pause

exit /b 1

Link to comment
Share on other sites

@echo off 
color 2
"C:\updates\Firefox Setup Stub 25.0.1"
echo Press any key when Firefox is done installing.
pause
"C:\updates\lenovographics.exe" 


SET /P ANSWER=Did 2 programs install correctly [y/n]? 
echo You chose: %ANSWER% 
if /i {%ANSWER%}=={y} (goto :yes) 
if /i {%ANSWER%}=={yes} (goto :yes) 
goto :no 
:yes 
echo You pressed yes! - Excellent. Thank you for your participation and cooperation
exit /b 0
:no 
echo You pressed no! Try this Program once more 
echo THEN Please send a detailed message to admin@work.com 
echo of any errors that occured
pause
exit /b 1

Genius! Thanks very much!

Small question about that:

In your example you used C: , would it make a difference if I had the installers on an external USB? That'll be the ultimate goal (Just plug in the usb and go)

Link to comment
Share on other sites

Hi,

If you want to detect the drive, then I suggest doing what was done in Hak5 episode of Ducky Exfiltration (one of the earliest episodes of season 15) and create a drive with a name like ducky, so that it will be able to detect where the update software is, then it should run and get all the files off of the USB. Just modify your batch script to do this and you should be hunkey dorey! :)

Cheers,

MB60893.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...