[Powershell] Script to install software

Today I want to check whether the Windbg is installed on the target machine with expected version, and if not, install the correct version with Powershell. It turns out that Powershell is really powerful to do such things.

$dbgApp = get-wmiobject -class "Win32_Product" -namespace "root\CIMV2" | where {$_.Caption -like '*Debugging Tools for Windows*'};
if ($dbgApp -eq $null -or !$dbgApp.Version.StartsWith("6.13"))
{
    msiexec /passive /i D:\Debug\dbg_amd64.msi;
}

Leave a Reply