Ok after a few weeks of playing around with the script and lots of help from Karlchen over at http://forum.sysinternals.com/default.asp
I got it running, it goes a little something like this:
:: Programme: remoteupd.bat
:: Function : copy update.vbs to \\target
:: launch update.vbs on \\target using psexec
:: &nbs p; will read computerlist.txt and launch update.vbs on each
:: &nbs p; of the hostnames\IPs inside the file
:: Status : third draft, arguments given on commandline, uses a listfile
:: Note : we will assume "computerlist.txt" is located in F:\Work Applications\WSUS Force Update, too.
:: Usage : remoteupd.bat adminuser password
:: Check that 2 arguments have been given on the commandline
if "%2"=="" (
echo usage: remoteupd.bat adminuser password
echo Try again.
exit /b 1
set ADMUSER="ADMIN USER\DOMAIN"
:: go to the source folder
cd \Work Applications\WSUS Force Update
:: check that the listfile is there
if not exist %LISTFILE% (
echo Listfile %LISTFILE% not found. Create it and try again.
exit /b 1
:: Finally, all checks done, let us do our work in a for loop
for /F %%i in (%LISTFILE%) do (
REM 1. net use if ADMPASS has got no space character the
REM double quotes may be removed
net use \\%%i\C$ /user:"ADMIN USER\DOMAIN" "PASSWORD"
REM 2. copy update.vbs
copy update.vbs \\%%i\C$\update.vbs
REM 3. disconnect from \\%TARGET%
net use \\%%i\C$ /dele
REM 4. psexec.exe, make sure this command is in 1 line!
psexec.exe \\%%i -u "ADMIN USER\DOMAIN" -p "PASSWORD" -e cscript.exe //B C:\UPDATE.vbs
:: 5. Done, delete variables
This will force any updates to the machines located in the "COMPUTERLIST.TXT" from my WSUS server by running the "UPDATE.VBS" script.
I however now have a few more questions for any WSUS people out there.
1. How can I keep duplicate computer names out of my WSUS server? I ran a "WSUS /DETECTNOW" script on a bunch of machines with positive results but of course a whole bunch of duplicates, is it possible to get them removed in a quick fashion?
2. New machines that are imaged and deployed? most effictive way to get them onto WSUS.
3. Machines that are no longer in production but still show up in AD? Therfore showing up in WSUS, how do I "cleanup" WSUS and get rid of machines that are no longer in production?
Thanks for your help.