Sean Plemons Kelly, CISSP
asked on
Windows updates batch files
Hello fellow experts!
Running into an issue with a batch file we have, with the purpose to install windows updates offline.
The above works great, but ONLY if it is run in a local folder, and from that folder.
Our issue, is that the server that we are running it on, has an OS partition, and is tossing errors based on the SETLOCAL part of it.
What I'm trying to (eventually) accomplish, is being able to deploy this as a script (or called from a .VBS) on our clients and member servers to install updates directly from the server, as well as allowing the host server to execute the batch file and install updates to itself from a separate partition.
Due to the nature of our setup, this MUST be accomplished via batch scripting or VBS. Third party software, and WSUS are not options here.
Cheers!
Running into an issue with a batch file we have, with the purpose to install windows updates offline.
@ECHO OFF&COLOR E && CLS && MODE 60,20&TITLE [ MULTI UPDATE INSTALLER ]
ECHO. Installing Windows Updates... Please Wait!
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
PUSHD %~dp0
FOR %AA IN (*-KB*.MSU) DO (
CALL :SUB %%~nA
ECHO= Installing KB!KB_NUM!
>NUL TIMEOUT /t 3
WUSA "%%~fA" /quiet /norestart)
ECHO= == Press any key to quit ==
>NUM PAUSE
REM SHUTDOWN.exe /r /t 0
PAUSEENDLOCALGOTO :EOF
:SUB
SET "KB_NUM=%*"
FOR /F "DELIMS=-" %%B IN ("%KB_NUM:*-KB=%") DO SET "KB_NUM=%%B"
The above works great, but ONLY if it is run in a local folder, and from that folder.
Our issue, is that the server that we are running it on, has an OS partition, and is tossing errors based on the SETLOCAL part of it.
What I'm trying to (eventually) accomplish, is being able to deploy this as a script (or called from a .VBS) on our clients and member servers to install updates directly from the server, as well as allowing the host server to execute the batch file and install updates to itself from a separate partition.
Due to the nature of our setup, this MUST be accomplished via batch scripting or VBS. Third party software, and WSUS are not options here.
Cheers!
I do see one problem the following line is wrong:
FOR %AA IN (*-KB*.MSU) DO (
and would need to be:FOR %%A IN (*-KB*.MSU) DO (
~bp
ASKER
@Bill Prew- That was actually a typo on my part, the script is %%A. Sorry!
@zalazar- Just to verify, that is going to just run through all the update files in a network folder location, and install them locally? Also, I'm not as familiar with VBS, how would that handle errors (I.E. incorrect OS patch, patch already installed ,etc)?
@zalazar- Just to verify, that is going to just run through all the update files in a network folder location, and install them locally? Also, I'm not as familiar with VBS, how would that handle errors (I.E. incorrect OS patch, patch already installed ,etc)?
So, if you don't want it to look for the files in the folder where the script exists, what folder do you want it to look for the files in?
~bp
~bp
ASKER
Current setup looks something like this:
Server-
OS Partition
Everything else partition, split into shares (For patches, we'll call it \\SERVER\Patches\)
Ideally, everything would be pulling the patches from that share. We can't use WSUS, so this (for now) is going to have to be our patch management "solution".
Server-
OS Partition
Everything else partition, split into shares (For patches, we'll call it \\SERVER\Patches\)
Ideally, everything would be pulling the patches from that share. We can't use WSUS, so this (for now) is going to have to be our patch management "solution".
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Script worked like a charm! Thanks for the help!
Open in new window
But I actually prefer to use a vbs script:
Open in new window