Pages

Saturday, 25 February 2023

Process

 # Define an array of process names

 $processNames = @("process_name_1", "process_name_2", "process_name_3")

 # Loop through the process names and check if they are running
 
 foreach ($processName in $processNames) {
     if (Get-Process $processName -ErrorAction SilentlyContinue) {
 
         Write-Host "$processName is running."
         # If the process is running, close it
 
         Stop-Process -Name $processName -Force
 
         Write-Host "$processName has been closed."
 
     }
 
     else {
 
         Write-Host "$processName is not running."
 
     }
 
 }
 
 

No comments:

Post a Comment

Test2

table {     border: 1px solid #1C6EA4;     background-color: #eeeeee;     width: 100%;     text-align: center; /* Center align all text */  ...

Search This Blog