The below thread explains how to check for more than 1 instance of a powershell script using get-wmiobject win32_process
Assure only 1 instance of PowerShell Script is Running at any given Time
For get-wmiobject win32_process
to list a running powershell script, that script needs to be invoked using powershell.exe scriptName.ps1
. How can I check for more than 1 instance of the script running where the script was invoked using .\scriptName.ps1
?