Automating Sysprep File Transfer to vCenter

Original article can be found here:

I was at my local Salt Lake City VMware User Group (VMUG) last week doing a Q&A when one of the users mentioned it is painful to only be able to upload one Sysprep file at a time to vCenter. I wanted to take the time to address this for him as well as any of you who may have the same issue.

Starting and Stoping a Powershell Script as a Job

You may start your script as a job.

start-job -scriptblock {. Pathofyourscript.ps1}

Then stop the job if CTRL+C is pressed:

[console]::TreatControlCAsInput = $true
while ($true) {

     Start-Sleep -s 30

     if ([console]::KeyAvailable) {

         $key = [system.console]::readkey($true)
         if (($key.modifiers -band [consolemodifiers]"control") -and ($key.key -eq "C")) { "Terminating..." }


        get-job | stop-job


Subscribe to RSS - script