Wednesday, February 26, 2014

How to check a process or program is running via powershell script

Powershell script to check if a program is running or not

$Prog = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
$Running = Get-Process firefox -ErrorAction SilentlyContinue
$Start = {([wmiclass]"win32_process").Create($Prog)}
if($Running -eq $null) # evaluating if the program is running
{& $Start} # the process is created on this line


navya said...

Great Article
C# Training in Chennai | C# Online Training | ASP.NET Training in Chennai

C# Training in Chennai | Dot Net Training in Chennai | Dot Net Training in Chennai

Brave Technologies said...

Thank you for this valuable information. Get your business to the next level in simple steps. We provides lowest price of erp Software for our clients erp in Chennai

Unknown said...

The actual time and effort taken to create this wonderful article were really great and would like to watch this blog regularly to get more useful stuff thanks much for sharing here...
Best Online Software Training Institute | Unix Linux Online Training