If I know a service name, and have enough permission, how do I set a Windows Service to be auto-restart in PowerShell?
I am using PowerShell 1.0, and the OS is Windows Server 2003.
You may be asking for:
Set-Service [service name] -startuptype automatic
See:
> get-help set-service
NAME
Set-Service
SYNOPSIS
Starts, stops, and suspends a service, and changes its properties.
SYNTAX
Set-Service [-StartupType {Automatic | Manual | Disabled}] [-DisplayName <string>] [-PassThru] [-Status <string>] [
-InputObject <ServiceController>] [-Description <string>] [-ComputerName <string[]>] [-confirm] [-whatif] [<CommonP
arameters>]
Set-Service [-Status <string>] [-StartupType {Automatic | Manual | Disabled}] [-Description <string>] [-Name] <stri
ng> [-PassThru] [-DisplayName <string>] [-ComputerName <string[]>] [-confirm] [-whatif] [<CommonParameters>]