Friday, May 1, 2026

PowerShell Script to Check if Visual Studio 2022 Is Installed on Remote Servers


Managing multiple Windows servers can be challenging, especially when you need to verify whether specific software is installed across your environment. One common request in enterprise IT environments is checking whether Visual Studio 2022 is installed on remote servers.

Instead of manually logging into each machine, you can automate the process using PowerShell Remoting.

In this blog, I’ll show you a PowerShell script that connects to remote servers, checks for Visual Studio 2022, displays results on screen, and exports the report to CSV.


Why Use This Script?

This script helps system administrators and IT teams:

  • Audit software installations across multiple servers
  • Verify developer tools are installed where needed
  • Save time by avoiding manual checks
  • Generate reports for compliance or inventory purposes

PowerShell Script

# List of remote servers
$Servers = @("Server01","Server02","Server03")
# Output file $OutputFile = "C:\Temp\VS2022_Check_Report.csv" # Create results array $Results = @() foreach ($Server in $Servers) { Write-Host "Checking $Server ..." -ForegroundColor Cyan try { $Result = Invoke-Command -ComputerName $Server -ScriptBlock { # Search registry for Visual Studio 2022 $paths = @( "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*", "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*" ) $vs = Get-ItemProperty $paths -ErrorAction SilentlyContinue | Where-Object { $_.DisplayName -match "Visual Studio" -and $_.DisplayName -match "2022" } | Select-Object -First 1 DisplayName, DisplayVersion if ($vs) { [PSCustomObject]@{ Installed = "Yes" Product = $vs.DisplayName Version = $vs.DisplayVersion } } else { [PSCustomObject]@{ Installed = "No" Product = "" Version = "" } } } $Results += [PSCustomObject]@{ Server = $Server Installed = $Result.Installed Product = $Result.Product Version = $Result.Version } } catch { $Results += [PSCustomObject]@{ Server = $Server Installed = "Connection Failed" Product = "" Version = "" } } } # Show output on screen $Results | Format-Table -AutoSize # Export CSV $Results | Export-Csv $OutputFile -NoTypeInformation Write-Host "`nReport saved to $OutputFile" -ForegroundColor Green

How This Script Works

1. Server List

Add all your remote servers inside the $Servers array.

$Servers = @("Server01","Server02","Server03")

2. Remote Connection

The script uses:

Invoke-Command

This runs commands remotely on each server using PowerShell Remoting.

3. Registry Search

It checks Windows uninstall registry paths:

  • 64-bit software path
  • 32-bit software path

Then searches for:

  • Visual Studio
  • 2022

4. Output Example

ServerInstalledProductVersion
Server01YesVisual Studio Professional 202217.8
Server02No
Server03Connection Failed

CSV Report Output

The script automatically creates:

C:\Temp\VS2022_Check_Report.csv

Useful for:

  • Audits
  • Asset management
  • Compliance reporting

Requirements

Before running:

Enable PowerShell Remoting

Run on remote servers:

Enable-PSRemoting -Force

Firewall Access

Ensure WinRM ports are open.

Permissions

Run the script using an account with admin rights on target servers.