PowerShell - Check system readiness for Thinscale Management Server

Prerequisites for installing Thinscale Management Server

Written by Ines

Last published at: April 13th, 2023

Script Events:

  • Discover OS version
  • Discover .NET Core and .NET Framework versions
  • Discover IIS version
  • Discover RAM size
  • Discover Free Disk Space


Results Example:


Script:


Write-Host "Checking system compatibility for installation of Thinscale Management Server..." -ForegroundColor Yellow

Write-Host ""


#find OS


$Version = (Get-WmiObject -Class win32_operatingsystem).Caption

if (($Version -like "*Windows Server 2019*") -or ($Version -like "*windows Server 2016*") -or ($Version -like "*windows Server 2012*")){

Write-Host "OS: " $Version ": COMPATIBLE" -ForegroundColor Green

}

else {

Write-Host  "OS: " $Version ": NOT COMPATIBLE - minimum OS requirement: Windows Server 2012" -ForegroundColor Red}


#Find net Core

$NetC = (Get-WmiObject -Class win32_Product | where {$_.name -like '*.net core runtime - *(x64*'})


if (($NetC.Name -like '*2.2*') -and ($NetC.Name -notlike '*3*')){

Write-Host ".NET Core:" $NetC.name "- COMPATIBLE" -ForegroundColor Green

}

else {

Write-Host ".NET Core:" $NetC.name ": NOT COMPATIBLE - .Net Core version requirement is 2.2" -ForegroundColor Red}



#Find net framework


$Framework = (Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version -EA 0 |

Where {($_.PSChildName -eq 'Full') -and ($_.Version -like '4.8*')}).Version



if ($Framework -like '*4.8*'){

Write-Host ".NET Framework:" $Framework "- COMPATIBLE" -ForegroundColor Green

}

else {

Write-Host ".NET Framework:" $Framework ": NOT COMPATIBLE - .Net Framework version requirement is 4.8" -ForegroundColor Red}




#Find IIS 8


$IIS = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("$env:SystemRoot\system32\inetsrv\InetMgr.exe").ProductVersion


if (($IIS -like '8*') -or ($IIS -like '9*') -or ($IIS -like '10*')){

Write-Host "IIS Version:" $IIS "- COMPATIBLE" -ForegroundColor Green

}

else {

Write-Host "IIS Version:" $IIS ": NOT COMPATIBLE - minimm IIS version requirement is 8" -ForegroundColor Red}



#Find RAM


$RAM = (Get-WmiObject -Class Win32_computersystem | select @{n="Memory";e={[math]::round($_.TotalPhysicalMemory/1GB, 2)}}).Memory


if ($RAM -ge '3'){

Write-Host "RAM:" $RAM "GB - COMPATIBLE" -ForegroundColor Green

}

else {

Write-Host "RAM:" $RAM "GB - NOT COMPATIBLE - minimum RAM requirement is 3GB!" -ForegroundColor Red}


#Find DiskSpace


$FreeSpace = (Get-WmiObject win32_logicaldisk | where {$_.DeviceID -eq 'C:'}  | Select @{n="FreeSpace";e={[math]::truncate($_.freespace / 1GB)}}).FreeSpace


if ($FreeSpace -ge '1'){

Write-Host "Free Disk Space:" $FreeSpace "GB - COMPATIBLE" -ForegroundColor Green

}

else {

Write-Host "Free Disk Space:" $FreeSpace "GB - NOT COMPATIBLE - minimum disk space requirement is 1GB!" -ForegroundColor Red}