Monday, February 12, 2018

Stop+Disable and Make Automatic+Start Windows Services using PowerShell.

When you need to make sure all Cisco services (Windows services) are stopped and set to manual but you need to do this on 20 servers and there's at least 10 services per server then you start doing things like this:

Stop and set Startup type to Manual:


Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Stop-Service $_.Name}
Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Set-Service $_.Name -StartupType Manual}
Set Startup type to Automatic and start:


Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Set-Service $_.Name -StartupType Automatic}
Get-Service |Where-Object {($_.DisplayName -like 'Cisco*')} |foreach {Start-Service $_.Name}

No comments:

Post a Comment