Archive for June, 2010

PowerShell script: backup running VMware VMs… Kind of

Thursday, June 17th, 2010

My first PowerShell script, it checks for running vms using vmrun, suspends them, backs up a designated VM directory using robocopy, and powers back on the suspended VMs.

#script settings
$backupfrompath = "c:\vms"
$backuptopath = "d:\vmsbackup"
#set location of vmrun command, can't use $env:ProgramFiles because of 64 bit OS
$vmrun = "C:\Program Files (x86)\VMware\VMware Workstation\vmrun.exe"

#get a list of currently running vms
$runningVMs = &$vmrun list | where-object {$_ -notlike "Total*"}

#loop through running vms and suspend them
Foreach ($guestSystem in $runningVMs) {if ($guestSystem.length -gt 0 ) {&$vmrun suspend $guestSystem soft}}

#backup vms folder using robocopy
$copycommand = "robocopy " + $backupfrompath +" " + $backuptopath +" /E /R:2 /W:10 /NP /LOG+:" +$backuptopath +"\robocopy.log"
invoke-expression $copycommand

#loop through suspended vms and resume them
Foreach ($guestSystem in $runningVMs) {if ($guestSystem.length -gt 0 ) {&$vmrun start $guestSystem}}

Notes:

  • When testing I noticed that a vm file was still in use on one occasion, possibly vmware still had a lock on it, so I set robocopy retries to 2 and wait to 10 seconds.
  • To allow PowerShell scripts to run on Windows 7 I had to run set-executionpolicy RemoteSigned in PowerShell.
  • I set up the backup in task scheduler using the following settings
    • program / script: powershell.exe
    • arguments: -NonInteractive -NoProfile -Command "&{C:\backup\vmbackup.ps1}"
    • My own user account with highest privileges (needed to suspend and restart start vm with vmrun), and do not store password checked. Had real problems with Error: Cannot connect to the virtual machine when the script running from task scheduler was trying to resume vms. In the End I changed the task to run under the administrators group, running with highest privileges. Don’t know if this is specific to my setup / Win 7 / Workstation 7.1.

Duplicate SID problems a myth, plus how to retrieve SIDs

Monday, June 14th, 2010

Although this doesn’t negate the use of sysprep and doesn’t apply do DCs

http://blogs.technet.com/b/markrussinovich/archive/2009/11/03/3291024.aspx

to get SID, download PsTools and run PsGetSid http://technet.microsoft.com/en-us/sysinternals/bb897417.aspx

Positive thinking? No – Realism

Wednesday, June 9th, 2010

Very interesting: www.youtube.com/watch?v=u5um8QWWRvo

Focus MK II front wheel arch rust

Wednesday, June 9th, 2010

Early Focus MK IIs (up until the 55 plate) did not have stone chip protection at the back of the front wheelarch at the end of the sills. Ford’s resolution was to fix a plastic protective strip from this point right to the back of the sills to all Focus II and C-max from 55 onwards.

FordĀ  issued a TSB (Technical Service Bulletin) for those with older cars who went to dealers and complained about rust. They still had to be covered by warranty and / or goodwill (note Ford’s anti-perforation warranty probably doesn’t apply to this as its rust from the outside in. And it seems you have to pay at each service for a bodywork inspection for the anti-perf warranty to be valid). The TSB is 722005 and it involves repairing the paintwork and fixing the same plastic strip used on newer cars

Since pre-55 plate Focuses don’t have the fixing points for the strip, the TSB describes cleaning the surface and using of two part adhesive to hold the strip in place. The plastic strip parts required for an estate are:

wheel arch protector: 1440535 (RHS) 1440536 (LHS)
plastic that runs sill length: 1380593 (RHS) 1380594 (LHS)

The parts might be the same for other focuses / c-max.

I decided I couldn’t be bothered with this potentially un-undoable fix and repaired the paintwork and installed mudflaps which cover, and, I hope will protect the vulnerable paintwork, although I’m not convinced that the paintwork repairs I did will hold for more than a few years.

EDIT: just found this post www.fordownersclub.com/forums/index.php?showtopic=8380 that refers to the problem. It seems that it still occurs even with the plastic strip fitted to 55-plate onward cars. Interesting as well about the cut sponge behind the wheelarch protector, on one side of my car it was cut too, a very clean cut that I assumed was intentional, but thinking about i now was probably damage during installation. When I was wringing it out I noticed that they have small perforations, presumably to make them easier to compress when installing, or to possibly allow any trapped moisture to evaporate.