launch autopatcher from networkshare


Recommended Posts

I've made a script that uses 7-Zip & generates a self extracting file that has the switches I use. Now that I know switches are changing, I'll have to modify it once the latest version of AP is out. Nonetheless, this works for me.

I make multiboot DVDs for XP installs. I have a RUNONCE command that runs the self-extracting file on the 1st boot up. It may be a little crude but it seems to work okay.

This is what I use to create the self-extracting file.

Create SFX Files.cmd

@ECHO OFF
CLS
TITLE 7-Zip :: AutoPatcher SFX file creator
::
::######################################################################
::Revised: 08:40 03/09/2007
::http://www.autopatcher.com/
::http://www.7-zip.org/
::######################################################################
::AutoPatcher releases updates on a regular basis.  I will update them
::and then use this batch file to create self-extracting 7-zip files.
::These come in handy!  You don't have to install the base file and all
::the updates (1-4 months worth) when you want to update a PC.  You can
::have a fully updated copy on a optical, network, or thumb drive!  When
::executed, they generate a randomly named directory in the %TEMP%
::directory.  Then, it runs AUTOPATCHER.EXE with the /NOEULA switch and
::the /UNATTEND:T2 switch.  Running these switches allows AutoPatcher to
::run almost silently.  All you notice is a little box that can't be
::closed and when it's done, it reboots the PC for you.
::######################################################################
::
:VARIABLES
::SETTING UP VARIABLES FOR EASE OF USE.  IN THEORY, YOU CAN MAKE CHANGES HERE AND THE REST OF THE SCRIPT SHOULD WORK.
::ALSO MAKE CHANGES IN THE CONFIG.TXT'S TITLE.
SET AUTOPATCHER2K="C:\PROGRAM FILES\AUTOPATCHER\2K"
SET AUTOPATCHERXP="C:\PROGRAM FILES\AUTOPATCHER\XP"
SET AUTOPATCHER2K3="C:\PROGRAM FILES\AUTOPATCHER\2K3"
SET AUTOPATCHERVISTA="C:\PROGRAM FILES\AUTOPATCHER\VISTA"
SET AUTOPATCHER="C:\PROGRAM FILES\AUTOPATCHER"
SET SEVENZIP="C:\PROGRAM FILES\7-ZIP"
SET BACKUP="C:\PROGRAM FILES\AUTOPATCHER\BACKUP"
::
::MOVES THE OLD 7-ZIP FILES FOR BACKUP REASONS.
IF EXIST %AUTOPATCHER%\*.7Z (MOVE /Y %AUTOPATCHER%\*.7Z %BACKUP%) ELSE ECHO FILE WAS NOT THERE TO BE MOVED.
::
::######################################################################
::
::DELETES THE OLD EXE FILES.
IF EXIST %AUTOPATCHER%\*.EXE (DEL /Q %AUTOPATCHER%\*.EXE) ELSE ECHO FILE WAS NOT THERE TO BE DELETED.
::
::######################################################################
:WIN2K
TITLE 7-Zip :: AutoPatcher SFX file creator :: Windows 2000
::
::CREATING CONFIG.TXT.
::KEEP THIS UPDATED!!!
ECHO;!@Install@!UTF-8! > %AUTOPATCHER%\CONFIG.TXT
ECHO Title="AutoPatcher : Windows 2000 : February 2007" >> %AUTOPATCHER%\CONFIG.TXT
ECHO BeginPrompt="This will dump a directory to a temp directory & run AutoPatcher.  OK?" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteFile="AutoPatcher.exe" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteParameters="/noeula /unattend:t2" >> %AUTOPATCHER%\CONFIG.TXT
ECHO;!@InstallEnd@! >> %AUTOPATCHER%\CONFIG.TXT
::
::COMPRESSING FILES TO A 7-ZIP FILE.
::THIS USES 7-ZIP TO ADD THE FILES TO A 7-ZIP FILE.
::THIS FILE IS NICE TO HAVE IF YOU DON'T WANT TO RUN AUTOPATCHER WITH ALL THE SWITCHES.
%SEVENZIP%\7Z.exe a -t7z %AUTOPATCHER%\AP2K.7Z %AUTOPATCHER2K%\*
::
::CREATING THE SELF EXTRACTING FILE FROM THE 7-ZIP FILE.
copy /b %SEVENZIP%\7zS.sfx + %AUTOPATCHER%\CONFIG.TXT + %AUTOPATCHER%\AP2K.7Z %AUTOPATCHER%\AP2K.EXE
::
::######################################################################
:WINXP
TITLE 7-Zip :: AutoPatcher SFX file creator :: Windows XP
::
::CREATING CONFIG.TXT.
::KEEP THIS UPDATED!!!
ECHO;!@Install@!UTF-8! > %AUTOPATCHER%\CONFIG.TXT
ECHO Title="AutoPatcher : Windows XP : February 2007" >> %AUTOPATCHER%\CONFIG.TXT
ECHO BeginPrompt="This will dump a directory to a temp directory & run AutoPatcher.  OK?" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteFile="AutoPatcher.exe" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteParameters="/noeula /unattend:t2" >> %AUTOPATCHER%\CONFIG.TXT
ECHO;!@InstallEnd@! >> %AUTOPATCHER%\CONFIG.TXT
::
::COMPRESSING FILES TO A 7-ZIP FILE.
::THIS USES 7-ZIP TO ADD THE FILES FROM TO A 7-ZIP FILE.
::THIS FILE IS NICE TO HAVE IF YOU DON'T WANT TO RUN AUTOPATCHER WITH ALL THE SWITCHES.
%SEVENZIP%\7z.exe a -t7z %AUTOPATCHER%\APXP.7Z %AUTOPATCHERXP%\*
::
::CREATING THE SELF EXTRACTING FILE FROM THE 7-ZIP FILE.
copy /b %SEVENZIP%\7zS.sfx + %AUTOPATCHER%\CONFIG.TXT + %AUTOPATCHER%\APXP.7Z %AUTOPATCHER%\APXP.EXE
::
::######################################################################
:WIN2K3
TITLE 7-Zip :: AutoPatcher SFX file creator :: Windows 2003
::
::CREATING CONFIG.TXT.
::KEEP THIS UPDATED!!!
ECHO;!@Install@!UTF-8! > %AUTOPATCHER%\CONFIG.TXT
ECHO Title="AutoPatcher : Windows 2003 : February 2007" >> %AUTOPATCHER%\CONFIG.TXT
ECHO BeginPrompt="This will dump a directory to a temp directory & run AutoPatcher.  OK?" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteFile="AutoPatcher.exe" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteParameters="/noeula /unattend:t2" >> %AUTOPATCHER%\CONFIG.TXT
ECHO;!@InstallEnd@! >> %AUTOPATCHER%\CONFIG.TXT
::
::COMPRESSING FILES TO A 7-ZIP FILE.
::THIS USES 7-ZIP TO ADD THE FILES FROM TO A 7-ZIP FILE.
::THIS FILE IS NICE TO HAVE IF YOU DON'T WANT TO RUN AUTOPATCHER WITH ALL THE SWITCHES.
%SEVENZIP%\7z.exe a -t7z %AUTOPATCHER%\AP2K3.7Z %AUTOPATCHER2K3%\*
::
::CREATING THE SELF EXTRACTING FILE FROM THE 7-ZIP FILE.
copy /b %SEVENZIP%\7zS.sfx + %AUTOPATCHER%\CONFIG.TXT + %AUTOPATCHER%\AP2K3.7Z %AUTOPATCHER%\AP2K3.EXE
::
::######################################################################
:VISTA
TITLE 7-Zip :: AutoPatcher SFX file creator :: Vista
::
::CREATING CONFIG.TXT.
::KEEP THIS UPDATED!!!
ECHO;!@Install@!UTF-8! > %AUTOPATCHER%\CONFIG.TXT
ECHO Title="AutoPatcher : Windows Vista : February 2007" >> %AUTOPATCHER%\CONFIG.TXT
ECHO BeginPrompt="This will dump a directory to a temp directory & run AutoPatcher.  OK?" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteFile="AutoPatcher.exe" >> %AUTOPATCHER%\CONFIG.TXT
ECHO ExecuteParameters="/unattend" >> %AUTOPATCHER%\CONFIG.TXT
ECHO;!@InstallEnd@! >> %AUTOPATCHER%\CONFIG.TXT
::
::COMPRESSING FILES TO A 7-ZIP FILE.
::THIS USES 7-ZIP TO ADD THE FILES FROM TO A 7-ZIP FILE.
::THIS FILE IS NICE TO HAVE IF YOU DON'T WANT TO RUN AUTOPATCHER WITH ALL THE SWITCHES.
%SEVENZIP%\7z.exe a -t7z %AUTOPATCHER%\APVISTA.7Z %AUTOPATCHERVISTA%\*
::
::CREATING THE SELF EXTRACTING FILE FROM THE 7-ZIP FILE.
copy /b %SEVENZIP%\7zS.sfx + %AUTOPATCHER%\CONFIG.TXT + %AUTOPATCHER%\APVISTA.7Z %AUTOPATCHER%\APVISTA.EXE
::
::DELETES THE TEMP FILES WE MADE
IF EXIST %AUTOPATCHER%\CONFIG.TXT (DEL /Q %AUTOPATCHER%\CONFIG.TXT) ELSE ECHO FILE WAS NOT THERE TO BE DELETED.
:END

Once you've got your executable, you just set that to run from your install source. It'll extract locally and you won't need to worry about running all of it over the net. You may still need to use that reg-hack I saw earlier (I've used it for other things & it works okay) in the forum. That would help you to initially run the executable. After that, it's all local so it won't matter too much.

A variable could work for running it from a source CD/DVD....

Examples:

SET CDROM=%CD:~0,2%

or

for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\path\to\yourfile.xyz set CDROM=%%a:

Edited by rkillcrazy
Link to comment
Share on other sites

Yeah, autopatcher will only run from a mapped drive from a network share. I used pushd and popd to temporarily map a drive and run autopatcher in between. Threw it into a batch file, and with CMDOW the cmd window calling the batch can even be hidden.

My batch is as follows:

----------------------------

@copy /y \\servername\autopatcher\cmdow.exe %systemroot%\system32\cmdow.exe

@cmdow @ /hid

pushd \\servername\autopatcher

autopatcher.exe /noeula /unattend:t2

popd \\servername\autopatcher

----------------------------

Of course, the /noeula prevents having to accept the eula, and the unattend:t2 completes the unattended aspect with just a small notification window. You could also use t3 to make it completely invisible.

This is in my startup scripts though, not during an unattended OS install, so YMMV.

Good morning,

I've been attempting to use AutoPatcher to catch up on missed updates for all of my end users. The batch file maps the network drive, updates the pc, but it doesn't take the defaults from the answers.ini file. I've saved the answers file as: Defaults.ini. This is what the add to my batch looks like:

pushd \\servername\autopatcher

autopatcher.exe /noeula /defaults:z:\autopatcher\defaults.ini /unattend:t2

popd \\servername\autopatcher

In my environment, pushd will always map to the z drive, and I only have to update the batch file for the server that it lives on. I can't figure out why autopatcher isn't calling the ini. I've tried different versions of the path; /defaults:defaults.ini, /defaults:\\servername\folder\autopatcher\defaults.ini.

Nothing seems to work, any help would be appreciated.

Thanks

Link to comment
Share on other sites

  • 3 months later...

I got mine to work by using the following. If you are having problems with the unc error coming up and the cmd window not hiding.

@echo off

pushd %~dp0

cmdow.exe @ /hid

autopatcher.exe /noreboot /unattend:t3 /noeula /defaults:defaults.aaf

popd

as long as the cmdow.exe file is in the AutoPatcher folder this should hide and work very well.

My only problem is that for some reason using /unattend:t3 doesnt hide the newer builds of autopatcher.

is there a new way to hide the autopatcher window?

Link to comment
Share on other sites

Well i finally figured out that you can do it this way without any problems.

@echo off

:: deletes the mapped network drive if there is one.

net use z: /del

:: map the network path below as drive z:

net use z: \\Servername\installs\AutoPatcher

:: the following command uses "z:\cmdow.exe @ /hid" to hide the cmd window

z:\cmdow.exe @ /hid

:: the following command runs the autopatcher executable from the network drive with an unattend command, a minimal window, and with an answerfile of "defaults.aaf"

z:\autopatcher.exe /unattend /minimal /answerfile:z:\defaults.aaf

:: deletes the mapped network drive z:

net use z: /del

As long as you have the answerfile located in the Autopatcher folder and the cmdow.exe file in there also. you can launch the .bat file and it will hide itself and install whatever is in your answerfile. The new build of autopatcher has new commandline args that i just noticed. So everything works perfect now. Thanks

I really enjoy this product in my line of work and I will definitely be donating here soon. Much Thanks. I Really appreciate it.

Link to comment
Share on other sites

  • 1 month later...

So if I run autopatcher from \\servername\autopatcher\autopatcher.exe that will run without error. This is ver. 6.5. Also how are the monthly updates incoporated into the run? Do you have run the monthly (June & July)updates separately from the share after the core?

Thanks in advance!!

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

If you run AP from a .CMD file using code something similar to:

@echo off
setlocal enableextensions enabledelayedexpansion
pushd %~dp0
autopatcher.exe /nolicense /verbose /log 
popd

then this will map a drive letter for you automatically anyway.

In addition the current directory is correctly set so you might have less issues with running some of the modules which currently fail.

Kind Regards

Simon

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.