mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-02-04 15:00:09 +00:00
Trim Trailing Whitespace
This commit is contained in:
@@ -1,24 +1,24 @@
|
||||
Function Set-WinUtilService {
|
||||
<#
|
||||
|
||||
|
||||
.DESCRIPTION
|
||||
This function will change the startup type of services and start/stop them as needed
|
||||
|
||||
.EXAMPLE
|
||||
|
||||
Set-WinUtilService -Name "HomeGroupListener" -StartupType "Manual"
|
||||
|
||||
#>
|
||||
|
||||
#>
|
||||
param (
|
||||
$Name,
|
||||
$StartupType
|
||||
)
|
||||
try {
|
||||
Write-Host "Setting Service $Name to $StartupType"
|
||||
|
||||
|
||||
# Check if the service exists
|
||||
$service = Get-Service -Name $Name -ErrorAction Stop
|
||||
|
||||
|
||||
# Service exists, proceed with changing properties
|
||||
$service | Set-Service -StartupType $StartupType -ErrorAction Stop
|
||||
}
|
||||
@@ -29,5 +29,5 @@ Function Set-WinUtilService {
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $_.Exception.Message
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user