Powershell script to check if LiteSpeed is installed

You could easily modify this to check if anything is installed really.

 
function CheckLiteSpeed($machineName)
{
       Write-Host $machineName
       $version = "";
       $reg = [WMIClass]"\\$machineName\root\default:stdRegProv"
       $HKEY_LOCAL_MACHINE = 2147483650
 
       $strKeyPath = "SOFTWARE\Imceda\SqlLiteSpeed\Engine"
       $version = $reg.GetStringValue($HKEY_LOCAL_MACHINE,$strKeyPath,"Version").svalue
       if($version -eq $null)
       {
 
               return "Not Installed"
       }
       return $version
}
 
Clear-Host
$destFile = "C:\LiteSpeedInstall.csv"
$servers = Get-Content "C:\Servers.txt";
 
if(Test-Path($destFile))
{
       Remove-Item -LiteralPath $destFile
}
Add-Content -LiteralPath $destFile "ServerName,LiteSpeedVersion"
 
foreach($server in $servers)
{
 
       $strVersion = "";
       $strVersion = CheckLiteSpeed($server);
       Add-Content -LiteralPath $destFile "$server,$strVersion";
 
}
 

Use at your own risk.  Not rigorously tested.

Bender out.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: