The other day I tweeted a short bit of code on how to automate the zeroing-out of your VDI images using SDelete:
I got quite a few DMs afterwards asking if it was possible to do the same with VMware’s OS Optimization Tool.
So without further ado, here’s the code I use as the last step in my Packer builds before closing them down for svMotioning:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ErrorActionPreference = "Stop" | |
| $webserver = "webserver.contoso.local" | |
| $url = "http://" + $webserver | |
| $files = @("VMwareOSOptimizationTool.exe","VMwareOSOptimizationTool.exe.config","my_osot.xml") | |
| $exe = $files[0] | |
| $arg = "-o -t " + $files[2] | |
| # Verify connectivity | |
| if (Test-Connection $webserver -Quiet){ | |
| # Get the OSOT files | |
| ForEach ($file in $files) | |
| { | |
| Invoke-WebRequest -Uri ($url + "/" + $file) -OutFile $env:TEMP\$file | |
| } | |
| } else { | |
| throw "No connection to server. Aborting." | |
| } | |
| # Change to temp folder | |
| Set-Location $env:TEMP | |
| # Run OSOT | |
| Try | |
| { | |
| Start-Process $exe -ArgumentList $arg -Passthru -Wait -ErrorAction stop | |
| } | |
| Catch | |
| { | |
| Write-Error "Failed to run OSOT" | |
| Write-Error $_.Exception | |
| Exit -1 | |
| } | |
| # Delete files | |
| ForEach ($file in $files) | |
| { | |
| Remove-Item -Path $env:TEMP\$file -Confirm:$false | |
| } |
Please remember to swap out your web server and to specify your own XML file. You could also YOLO it and use one of the built-in templates…

…but don’t be surprised when you cripple half your apps 🙂

In
When large enterprises deploy a cloud management platform like VMware vRealize Automation, they often have a number of different environments. To ensure best practices, blueprints and orchestration scripts are created in development before being tested in another environment, before finally being transported intoÂ
Next Thursday the UK VMUG UserCon will be held at the National Motorcycle Museum in Birmingham. This is a jam-packed event with speakers covering a wide-range of topics such as digital transformation, end-user computing, containerisation and of course, automation.
Earlier this week I had an issue in vRealize Automation where logged-on usernames were being displayed incorrectly. At first I hoped it was just a cosmetic issue, but as I delved deeper it appeared to be a little more than that, and could be an issue for both users and developers.