PowerShell Script to Restrict Application to a Single Instance
Here is a simple Powershell code that checks if a specified process is already running and launches second instance of the application if it’s not already running. [code language=”powershell”] $process = "mspaint" $ret = Get-Process -Name $process -ErrorAction SilentlyContinue if ($ret) { Write-Host "INFO: $process already running, skipping start of another instance of the same process" } else { Write-Host "VERBOSE: Starting $process now" Invoke-Item "$process.exe" } [/code] .
Read more