check if service is running ...
1) BATCH:
check if service (param %1 of batch script) is running in windows:
@echo off
:active :end |
2) Powershell:
| check if service (param %1 of ps1 script) is running in windows: param($ServiceName) if(Get-Service -Name $ServiceName | where {$arrService.Status -ne "Running"}){Write-Host "service $ServiceName is Running"}else{Write-Host "service $ServiceName is not Running"} |
3) Python:
check if service (param SvcName of python script) is running in all OS:
(NOT TESTED: i do not get all OS ;) )
| import argparse;parser = argparse.ArgumentParser();parser.add_argument("SvcName");args = parser.parse_args();ServiceNamecName = args.SvcName import psutil;ServiceNamecName in (p.name() for p in psutil.process_iter()) |
/image%2F0881799%2F20140610%2Fob_a8c7fe_logo2.jpg)
Commenter cet article