launch autopatcher from networkshare


Recommended Posts

Hi,

Is it possible to execute autopatcher from a network?

What i like to do is:

I've extracted/installed the latest autopatcher xp

I moved the complete autopatcher directory from programfiles to a net workshare.

I've placed this command in winbom.ini

[OemRunOnce]

"AutoPatcher","""\\servername\d\AutoPatcher\AutoPatcher.exe"" "

but after i agree with the terms of use i get a runtime error 5

anyone suggestions?

Link to comment
Share on other sites

Hi,

Is it possible to execute autopatcher from a network?

What i like to do is:

I've extracted/installed the latest autopatcher xp

I moved the complete autopatcher directory from programfiles to a net workshare.

I've placed this command in winbom.ini

[OemRunOnce]

"AutoPatcher","""\\servername\d\AutoPatcher\AutoPatcher.exe"" "

but after i agree with the terms of use i get a runtime error 5

anyone suggestions?

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.

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.

Thanks, Ill give it a try

What does this command actually does? pushd and popd?

What i want to do is add updates to autopatcher without making a new ghost image.

So i only have to update/add updates to autopatcher which is placed on a network share.

I hope you understand what i mean

Edited by arjanv
Link to comment
Share on other sites

Thanks, Ill give it a try

What does this command actually does? pushd and popd?

What i want to do is add updates to autopatcher without making a new ghost image.

So i only have to update/add updates to autopatcher which is placed on a network share.

I hope you understand what i mean

Sure do, I do exactly the same thing for the same reasons. Autopatcher has reduced my image creation tasks easily by half. We manually run autopatcher on our newly ghosted machines, and run it automatically on each startup to keep our machines completely updated.

According to the help files, pushd "will create a temporary drive letter that points to that specified network resource and then change the current drive and directory, using the newly defined drive letter. Temporary drive letters are allocated from Z: on down, using the first unused drive letter found." Popd "will delete any temporary drive letter created by PUSHD when you POPD that drive off the pushed directory stack."

You could of course just create a permanent drive mapping (not you yourself, you figuratively) and not bother with pushd and popd, but in my environment I can't be sure any drive letter is free, so this works to pick one for me.

Link to comment
Share on other sites

Sure do, I do exactly the same thing for the same reasons. Autopatcher has reduced my image creation tasks easily by half. We manually run autopatcher on our newly ghosted machines, and run it automatically on each startup to keep our machines completely updated.

According to the help files, pushd "will create a temporary drive letter that points to that specified network resource and then change the current drive and directory, using the newly defined drive letter. Temporary drive letters are allocated from Z: on down, using the first unused drive letter found." Popd "will delete any temporary drive letter created by PUSHD when you POPD that drive off the pushed directory stack."

You could of course just create a permanent drive mapping (not you yourself, you figuratively) and not bother with pushd and popd, but in my environment I can't be sure any drive letter is free, so this works to pick one for me.

Hi, rtk

Thanks for your help.

It works perfectly.

Link to comment
Share on other sites

  • 2 weeks later...

:yes: This Deserves a sticky! Bump

I tried mapping with net use without any luck, this worked great!

I'd vote for it to be added to the "FAQ / Common Problems & Solutions" thread instead of making this one sticky.

At least or until AP supports UNC paths, this solution does seem to work well.

Link to comment
Share on other sites

  • 1 month later...

I don't have a lot of experience with AutoPatcher but the batch method described worked perfectly.

1. Can new updates be applied to the network share or does it need to be done locally and copied to the share?

2. Is there a way to configure so that the user installing can select when the system is restarted instead of it automatically rebooting?

3. How do I configure AutoPatcher to have all the available Critical and Recommended updates as the default?

Link to comment
Share on other sites

  • 3 months later...

Thanks rtk !!!

Q1: In wanting to use a /defaults ini like:

/noeula /defaults:C:\AutoPatcher\elmcity.ini

What variable would be used for the drive letter?

Q2: When ever I open the batch file from the AP share on the server

\\Server\AutoPatcher

The first thing I get is this error

CMD.EXE was started with the above path as the current directory.

UNC paths are not supported. Defaulting to Windows directory.

no big deal, the next step works anyways - but is there a way to get rid of this?

Do you run it from C: instald of the share

Link to comment
Share on other sites

try changing the first line to @copy /y cmdow.exe %systemroot%\system32\cmdow.exe

Theoretically it will copy cmdow from the directory which launched the batch script.

Thats where the UNC paths error is occuring.

Link to comment
Share on other sites

Hi,

As an option, you can use a .CMD file directly from the share or a remote drive using the following code:

 @echo off
 pushd %~dp0
 autopatcher
 popd

Place this in a .CMD file and place it in the same folder as autopatcher.exe.

The %~dp0 code means "My Expanded Drive and Path" e.g the path to the .CMD file itself.

This means the code is portable to any folder without being changed.

The only fly in the ointment here is that the .CMD window will not change to the working directly if the path is in a UNC path. However the code will still run anyway.

There is a Registry fix for this issue; when I locate the settings I will update my posting.

Kind Regards

Simon

Link to comment
Share on other sites

Appreciate the support ... still getting error. I will try to clarify more....

I d-click ap.bat (code below) from here \\server\AutoPatcher

pushd \\Server\AutoPatcher

pause

autopatcher.exe /noeula

popd \\Server\AutoPatcher

FYI same thing happens when I d-click ap2.bat (code below) from here \\server\AutoPatcher

pause

pushd %~dp0

pause

autopatcher /noeula

popd

Here's the error - I think it's just from running a BATCH file from a unc path - pushd %~dp0 works nicely!!!

'\\Server\AutoPatcher'

CMD.EXE was started with the above path as the current directory.

UNC paths are not supported. Defaulting to Windows directory.

C:\WINDOWS>pushd \\Server\AutoPatcher\

Y:\>pause

Press any key to continue . . .

OH can anyone answer my first question?

Q1: In wanting to use a /defaults ini like:

/noeula /defaults:C:\AutoPatcher\elmcity.ini => /noeula /defaults:???\AutoPatcher\elmcity.ini

What variable would be used for the drive letter?

- Thank You - Thank You - Thank You - Thank You - Thank You - Thank You -

Link to comment
Share on other sites

Ah ha! No longer getting "UNC paths are not supported" error

Found this reg tweak at http://www.ss64.com/nt/cmd.html

;Allow UNC paths at command prompt

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]

"DisableUNCCheck"=dword:00000001

still need help here:

Q1: In wanting to use a /defaults ini like:

/noeula /defaults:C:\AutoPatcher\elmcity.ini => /noeula /defaults:???\AutoPatcher\elmcity.ini

What variable would be used for the drive letter?

Also ... anyone have a reference for directory commands between percentage marks???

like %system32%

and PsiMoon314 where did you find %~dp0 !!!

Link to comment
Share on other sites

Ah ha! No longer getting "UNC paths are not supported" error

Found this reg tweak at http://www.ss64.com/nt/cmd.html

;Allow UNC paths at command prompt

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]

"DisableUNCCheck"=dword:00000001

I'd guess this prevents the check, which would prevent the "error" from appearing only. Still a good find though. ;-)

still need help here:

Q1: In wanting to use a /defaults ini like:

/noeula /defaults:C:\AutoPatcher\elmcity.ini => /noeula /defaults:???\AutoPatcher\elmcity.ini

What variable would be used for the drive letter?

Also ... anyone have a reference for directory commands between percentage marks???

like %system32%

and PsiMoon314 where did you find %~dp0 !!!

@PsiMoon: truly a good find, that %~dp0. @Rgabriele, google it and you'll find several sources of info on what it is and does. From Loren Halvorson's Blog : Silly batch file tricks, redirecting stdout into an evironment variable and %~dp0

Since I'm on the topic of useful/(or useless?) batch file tricks, another little known one I find myself using alot is the "%~dp0" macro which resolves to the fully expanded path to the directory containing the batch file. This allows batch files to run regardless of the current working directory.

Based on this, I'd probably be experimenting with not having a path at all....

/noeula /defaults:elmcity.ini

or

/noeula /defaults:.\elmcity.ini maybe?

Let us know how you make out!

Link to comment
Share on other sites

You nailed rtk

DisableUNCCheck prevents the check, which would prevent the "error" from appearing only

So no real need to bother with the DisableUNCCheck, since it works either way

This is simple and works - maps, runs from anywhere, and then disappears - cool!

pushd %~dp0

autopatcher /noeula /defaults:elmcity.ini

popd

Thanks for the environment variables links ... was looking all over w/o any luck

Here's a microsoft link ... same info

http://www.microsoft.com/resources/documen...w.mspx?mfr=true

Link to comment
Share on other sites

  • 3 weeks later...

I'd just like to point out that cmdow.exe is detected as a 'Hacker Tool' by some anti-virus programs. I love to run AP from a central server when doing updates on collegues machines but having a 'Hacker Tool' installed didn't go over so well with some of them (at least until I had a chance to explain). Mostly Norton does this (ugh Norton...) and describes it as "A tool used to hide command windows and run secret commands" or something similar. Regardless of what it is I just thought I'd point this out before it happens to someone else. There were two solutions I tried, the first was to add a DEL command to the end of the batch file to remove cmdow.exe from the system root, but that didn't always work (seems Norton likes to lock and quarantine the file without notifying me). The second option use this as the first line of the batch file instead:

@\\ComputerName\AutoPatcher\cmdow.exe @ /hid

None of the antivirus programs seem to care at all about this (probably because they don't scan unmapped network shares) so it all works out for the best.

Link to comment
Share on other sites

Hi Guys,

I am glad that the %~dp0 info worked for you :D

This sort of .CMD code has been used for a while when making Windows PE / BartPE based boot CD's and the plugins that this uses.

Here are some others you can use:

@echo off
setlocal enableextensions
cls
echo.
echo	 I am file (not yet expanded):		 %0
echo	 My Expanded File Name:				%~n0
echo	 My Expanded Extension:				%~x0
echo	 My Expanded Name and Extension:	   %~nx0
echo	 My Expanded Drive:					%~d0
echo	 The Expanded Root of My Drive:		%~d0\
echo	 Some Other Expanded Path on My Drive: %~d0\SomeOtherPath
echo	 My Expanded Path:					 %~p0
echo	 My Expanded Drive and Path:		   %~dp0
echo	 My Expanded full filename and path	%~f0
echo	 My Expanded short filename path	   %~dps0
echo.

These others might come in useful for other projects. I use this code as a reference. Pop it into a .CMD file and run it to see the output.

Kind Regards

Simon

Link to comment
Share on other sites

  • 6 months later...

How do you control which updates are installed? When testing this process it appears as though it installed everything (specifically IE 7, windows journal and Windows Defender).

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.