Skip to content

Instantly share code, notes, and snippets.

@tobynet
Created August 13, 2015 01:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobynet/e62cb4513d10b4a46439 to your computer and use it in GitHub Desktop.
Save tobynet/e62cb4513d10b4a46439 to your computer and use it in GitHub Desktop.
Windows でのサービスの制御 ref: http://qiita.com/toby_net/items/07bf96d1f56d9dbe6602
PS> gsv | ? { $_.Name -match "sqlserver" }
Status Name DisplayName
------ ---- -----------
Running MSSQLSERVER SQL Server (MSSQLSERVER)
Running MSSQLServerOLAP... SQL Server Analysis Services (MSSQL...
Stopped SQLSERVERAGENT SQL Server エージェント (MSSQLSERVER)
PS> gsv | ? { $_.Name -match "sql" -and $_.Status -match "Run" }
Status Name DisplayName
------ ---- -----------
Running MSSQLFDLauncher SQL Full-text Filter Daemon Launche...
Running MSSQLSERVER SQL Server (MSSQLSERVER)
Running MSSQLServerOLAP... SQL Server Analysis Services (MSSQL...
Running SQLWriter SQL Server VSS Writer
PS> gsv | ? Name -match "sql" | ? Status -match "Run"
PS> gsv | ? Name -match "mssql" | Stop-Service
PS> gsv | ? Name -match "mssql" | Set-Service -StartupType Manual
PS> gsv | ? Name -match "mssql" | Set-Service -Status Stopped -StartupType Manual
Set-Service : サービス 'SQL Server (MSSQLSERVER) (MSSQLSERVER)' には依存サービスがあるため、停止できません。
発生場所 行:1 文字:31
+ ... Name -match "mssql" | Set-Service -Status Stopped -StartupType Manual
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.ServiceProcess.ServiceController:ServiceController) [Set-Servi
ce]、ServiceCommandException
+ FullyQualifiedErrorId : ServiceHasDependentServicesNoForce,Microsoft.PowerShell.Commands.SetServiceCommand
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment