Looking to Automate Windows Updates on Virtual Machines and need some help

  • Thread starter Thread starter Alan_Barclay_Uk
  • Start date Start date
A

Alan_Barclay_Uk

Guest
Hi Guys

Hope I've posted this in the correct forum.

I've been tasked with developing a small application using visual basic to automate the installation of windows updates on our companies collection of virtual machines.

Currently I have the application loading a database of the various virtual machines which it processes on a specific date (last Friday of the month!) within a pre-set time 8pm till 6am every day until the task completes, all of this is working 100% except for the individual processing of the virtual machines. The following list details the steps I'm using...

1) FOR EACH VIRTUAL MACHINE IN DATABASE [DONE]

"for each VM as vmType in VMs"

2) START VIRTUAL MACHINE [DONE]

"pID = Shell(String.Format("{0}{1}{0} Start {0}{2}{0}",chr(34), "VMRun.exe", VM.Name))"

3) DETECT WHEN GUEST OS HAS STARTED

I've tried several methods of detecting when the guest OS is running, but none appear to be working. all attempts return while the guest OS is still booting?

4) RUN WINDOWS UPDATE TO SILENTLY INSTALL ALL LATEST UPDATES

"pID = Shell(String.Format("{0}{1}{0} -gu {0}{2}{0} -gp {0}{3}{0} runProgramInGuest {0}{4}{0} {0}{5}{0}", Chr(34), VMWare, VM.User, VM.Password, VM.Name, "wuapp.exe"))

The above code doesn't appear to be working it doesn't even start Windows update? I've even tried running a batch file no difference!

5) WAIT TILL ALL UPDATES & INSTALLED INCLUDING ANY RE-BOOTS

Not quite sure how to achieve this, I'm thinking around the lines of using the process exit code?

6) SHUTDOWN VIRTUAL MACHINE [DONE]

"pID = Shell(String.Format("{0}{1}{0} Stop {0}{2}{0}",chr(34), "VMRun.exe", VM.Name))"

7) WAIT TILL VIRTUAL MACHINE HAS STOPPED [DONE]

"do: loop until Process.GetProcessByID(pID).hasExited()"

8) NEXT VIRTUAL MACHINE [DONE]

"next"

note* I get errors at step 4 if I don't wait till the Guest OS has fully started.

to give some additional information... these virtual machines are client specific development environments that are only used when required (2 to 3 times a year!), this project it to remove the (hours of updating) prior to making the required client requests.

The database is configured to hold the path/name of the virtual machine, a username & password plus some additional information, this is to allow easy addition or removal of other Virtual Machines.


Regards Alan

Continue reading...
 
Back
Top