update
This commit is contained in:
21
bibliotheque/files/nsclient/scripts/op5/restart_service.ps1
Normal file
21
bibliotheque/files/nsclient/scripts/op5/restart_service.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
# Restart Service Script
|
||||
# Please enable external scripts and external scrips variable before use.
|
||||
|
||||
param (
|
||||
[string[]]$serviceName
|
||||
)
|
||||
Foreach ($Service in $ServiceName)
|
||||
{
|
||||
Restart-Service $ServiceName -ErrorAction SilentlyContinue -ErrorVariable ServiceError
|
||||
If (!$ServiceError) {
|
||||
$Time=Get-Date
|
||||
Write-Host "Restarted service $Service at $Time"
|
||||
}
|
||||
If ($ServiceError) {
|
||||
write-host $error[0]
|
||||
exit 3
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user