vbWSUS : how to install Windows Updates remotely on a per host schedule
-
Wednesday, March 21, 2012 11:29 PM
Hello,
I already posted it in the WSUS forum but I believe after all (since someone suggested it to me in the other forum) that it may be of interest to publish it here.
I would appreciate any feedback on "dirty" coded things, best practices not applied, etc.
The script may also be of some interest for some of its "original" functions :
# cron2date(strCron)
- strCron : string matching a crontab like format (ie: 30 2 * * 3#4) 30 2 * * 3#4 = the 4th (#4) thursday (3) of the current month at 2:30 AM
- Return value : the full YYYY-MM-DD HH:mm matching strCron
- Example :
strDate = cron2date(30 2 * * 3#L) wscript.echo strDate ' outputs 2012-03-22 02:30
# customDate(date, strFormat)
- date : any timestamp (ie: Now)
- strFormat : the expected output format (currently 2 formats are supported : "YYYYMMDD", "YYYYMMDD_HHmm")
- Return value = the date fitted in the strFormat
- Example =
strDate = customDate(Now, YYYYMMDD_HHmm) wscript.echo strDate ' outputs 20120322_0025
# proxy2bin(strURL)
Convert strURL to a binary chain in order to update a registry binary value.
There is also a function to includes subfiles in the script without using a wsf file. I use it to load a configuration file and a common function library
Comment !
Yoann
You'll find the functions in the vbWSUS_scheduler.vbs and lib\common.inc in the zip that you can download here https://sourceforge.net/projects/vbwsus/
- Edited by snoopscratchy Wednesday, March 21, 2012 11:35 PM forgot the link
- Edited by snoopscratchy Thursday, March 22, 2012 12:42 PM formatting
All Replies
-
Wednesday, March 21, 2012 11:57 PM
Can you please translate this from "snoop-scratchy-scratch" to "english-scratchy-scratch".
We are usuallu good at renslations like this but your usage is unusual.
I know we are all very 'nix' here and you newbies don't understand these tough techincal requirements but - have a heart - we need your translation.
Start here and read carefully - http://social.technet.microsoft.com/Forums/en-US/ITCG/thread/a0def745-4831-4de0-a040-63b63e7be7ae
¯\_(ツ)_/¯
-
Thursday, March 22, 2012 12:38 PM
Hello,
Sorry I don't understand your reply. I assume your saying that my post is inappopriate ?
I ll try to add a better formating if this is the issue.
Yoann
-
Thursday, March 22, 2012 2:28 PM
Hello,
Sorry I don't understand your reply. I assume your saying that my post is inappopriate ?
I ll try to add a better formating if this is the issue.
Yoann
Even with better formatting I cannot understand what teh question is.
What is not happening or what error messages are you getting.
We know about the WSUS scripts but why are you posting this here?
None of this has anything to do with using WSUS to install updates. Individual machines and updates can be applied as needed using WU functions. See the demo code in the repository if this is what you are trying to do. WindowsUpdate - http://gallery.technet.microsoft.com/scriptcenter/site/search?query=windowsupdate&f%5B0%5D.Value=windowsupdate&f%5B0%5D.Type=SearchText&ac=3
WU can do all of this remotely without installing or modifying the target machine. It may be a good solution for you assuming your question is how to cause an update cycle son a per machine basis or by update package.
¯\_(ツ)_/¯
-
Thursday, March 22, 2012 7:03 PM
Hello,
sorry there is nothing not working in the scripts I provided and if there is I d really happy to hear about it !
I just wanted this tool that I developed in vbscript and also tell people looking for vbscripts (which the scripting guys is about) to remotely start updates and reboot a computer or discover new things (like how to edit a binary value in registry).
Yoann
-
Thursday, March 22, 2012 7:27 PM
Hello,
sorry there is nothing not working in the scripts I provided and if there is I d really happy to hear about it !
I just wanted this tool that I developed in vbscript and also tell people looking for vbscripts (which the scripting guys is about) to remotely start updates and reboot a computer or discover new things (like how to edit a binary value in registry).
Yoann
Ahah - If you're sharing scripts there e is a repository that you can put the scripts in. It is on the top menu.
Placing scripts in the forum will not necessarily get this shared easily.
You posted this as a question when the topic type should be informational/discussion. You can change the type be editing your initial post and selecting "change type".
You might also add your comment about sharing the script into the original post as it is very unclear as to why it is posted. There is no 'cron' in Windows. cron is a Unix scheduling utility. WSUS does its own scheduling using database timing and some assistance from the Task Scheduler Service. This service uses the Task Scheduler API to schedule all kinds of tasks and uses the WMI SWbemDateTime format. The system has a converter object for that format so it does not make much sense to use cron formats.
As I noted before I am not quite sure why you would use WSUS objects to do client level work or why schedule tasks on a client when we can just remote the call using the WU objects. They can trigger updates remotely without running PsExec. This eliminates any need to create anything on the remote system.
The beauty of Windows Update and WSUS is that all of the components are installed with the OS WSUS does not need to do anything nut function just like the Microsoft WU or MU servers. The clients update themselves. We can use WUclient object to trigger an update to WSUS or to MS update. We can trigger the update for a single package or a group of packages. This is the design of WU and WSUS.
Take a look at the code from the linke that I posted above. I think you will find it very informative.
Of course itf your code does something other than remote scheduling you should mention it. I took a quick look but could not see what it could do outside of what WU and WSUS already do.
Of course it ia very large piece of scripting and I suspect ti was written before WSUS 3.0 and so may duplicate some functionality. I also suspect it was written before the WU documenation was published. The remoting of WU was never noted in the online documentaion.
Look at the link examples. You can probably retrofit your scripts to make them more simple.
I recommend sticking to system datatime objects as they are more convertible in Windows.
Datetimes like 02/04/2012 22:33:00 will convert readily. Intervals can be esily creaed using DateDiff and all camn be formatted with FormatDateTime. SWbemDateTime object cancovert all VB datetimes and intervals very easily.
¯\_(ツ)_/¯
- Edited by jrvMicrosoft Community Contributor Thursday, March 22, 2012 7:34 PM
-
Thursday, March 22, 2012 8:49 PM
Thanks for pointing the repository, dropped my tool there :)
I think anyway that you ve not really understand what this tool is doing :
Prerequisite :
- write a CSV file with right syntax, each line looking like :
<cron syntax>;hostname;ipaddress
- schedule a task on ONE computer to run vbWSUS_scheduler.vbs
- this computer must have IPC$ access (i don't know if we really call it like that) to each computer, you can specify specific credentials if needed
Then, once the scheduled task starts :
1/ reads a csv file
2/ for each line, compare the scheduled date with the current time
3/ on match, triggers remote update install and reboot if needed
4/ sends an email on update processus starting and on update processus end with installation results
Say you have 15 production servers running different tasks at different times and you have a small maintenance window that is different from one server to another, you can with this tool decide when each server installs its update from a centralized "server".
Or you work in a datacenter, you provide a maintenance service to your clients on the schedule of their choice.
One client wants his different servers to reboot on a schedule specific to each server and this other client wants another specific schedule for every of his servers.
With this in mind, how would you do it working with Windows Update Automatic Updates or WSUS so it s as easy to administrate as vbWSUS provides ?
Two requirements :
- we don't want human interaction to start the update process on each server
- we want an easy management of the schedule and specific parameters that may be applied to one server but not the other ?
Bonus requirement :
- we want easy monitoring of what went wrong on last update
Yoann
- Edited by snoopscratchy Thursday, March 22, 2012 8:50 PM
- Marked As Answer by Bill_StewartMicrosoft Community Contributor, Moderator Friday, April 27, 2012 1:56 PM
-
Thursday, March 22, 2012 9:01 PM
Thanks for pointing the repository, dropped my tool there :)
I think anyway that you ve not really understand what this tool is doing :
Prerequisite :
- write a CSV file with right syntax, each line looking like :
<cron syntax>;hostname;ipaddress
- schedule a task on ONE computer to run vbWSUS_scheduler.vbs
- this computer must have IPC$ access (i don't know if we really call it like that) to each computer, you can specify specific credentials if needed
Then, once the scheduled task starts :
1/ reads a csv file
2/ for each line, compare the scheduled date with the current time
3/ on match, triggers remote update install and reboot if needed
4/ sends an email on update processus starting and on update processus end with installation results
Say you have 15 production servers running different tasks at different times and you have a small maintenance window that is different from one server to another, you can with this tool decide when each server installs its update from a centralized "server".
Or you work in a datacenter, you provide a maintenance service to your clients on the schedule of their choice.
One client wants his different servers to reboot on a schedule specific to each server and this other client wants another specific schedule for every of his servers.
With this in mind, how would you do it working with Windows Update Automatic Updates or WSUS so it s as easy to administrate as vbWSUS provides ?
Two requirements :
- we don't want human interaction to start the update process on each server
- we want an easy management of the schedule and specific parameters that may be applied to one server but not the other ?
Bonus requirement :
- we want easy monitoring of what went wrong on last update
Yoann
Why do you use PsExec and not WU client.
Why mot just schedule each computer as a seprate task in Task Scheduler or why not just schedule a task with WU remotely.
I would just run WU at a specific time and create a on time schedule andhave teh scheduled taks renew its status so cahnges can be made.
Of you script does what you need then OK. I just wanted to make you aware that the WU client eliminates the need for PsExec.
In two of my networks PSExec is not allowed. I use teh WU client to trigger updates. Iyt pnly takes a couple of lines of code. I can then use WU client to retrive the status and mail it or write ot a database.
WSUS also does all of this reporting so I usually just creet a custom WSUS report. No one cares when only if the updates were successful.
¯\_(ツ)_/¯
-
Friday, April 27, 2012 1:56 PMModerator
I didn't see a question in this thread - my understanding is you are posting to share a script, so I will mark that as the answer.
Bill
-
Tuesday, May 15, 2012 12:23 AMThere's actually an app that enables you to remotely install Windows updates with integrated reboots and monitoring. It can also push 3rd party patches, software, reg keys, remote scripts etc. And Wake On LAN too. The evaluation version is free and fully featured, with the only exception that you are limited to only 7 hosts at a time. http://batchpatch.com

