タグ別アーカイブ: posershell

PowerShell Windowsサービスの停止・開始

PowerShellでWindowsサービスを停止、開始するサンプルです。

Vbscriptでもサービス停止と開始については、紹介しておりますが
PowerShellだと簡単に書けます。

VBScriptのサンプルはこちら

■サービスの状態を確認
例)WSearchの確認

gsv | ? { $_.Name -match "WSearch" -and $_.Status -match "Run" }

11

 

 

■サービスの停止

gsv | ? { $_.Name -match "WSearch" -and $_.Status -match "Run" } | Stop-Service

■サービスの停止

gsv | ? { $_.Name -match "WSearch" -and $_.Status -match "Stop" } | Start-Service

Bookmark this on Yahoo Bookmark
Bookmark this on Google Bookmarks
Share on LinkedIn
LINEで送る
Pocket