Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "1. View all services"
- "2. View enabled services"
- "3. View disabled services"
- "4. Enable service"
- "5. Disable service"
- "0. Exit"
- [int]$choice = $(read-host "Enter a number: ")
- Switch($choice){
- 1 {Get-service}
- 2 {Get-service | Where-Object {$_.Status -EQ "Running"} }
- 3 {Get-service | Where-Object {$_.Status -EQ "Stopped"}}
- 4 {
- [string]$service = $(read-host "Enter a name of service: ")
- Start-Service -Name $service
- }
- 5 {
- [string]$service = $(read-host "Enter a name of service: ")
- Stop-Service -Name $service
- }
- 0 {exit}
- Default {″Out of range″; exit}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement