368d6fafea
Code backup
34 lines
1015 B
PowerShell
34 lines
1015 B
PowerShell
function Get-MrTriggerStartService {
|
|
|
|
[CmdletBinding(DefaultParameterSetName='Name')]
|
|
param (
|
|
[Parameter(ParameterSetName='Name',
|
|
Position=0)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string]$Name = '*',
|
|
|
|
[Parameter(ParameterSetName='DisplayName')]
|
|
[ValidateNotNullOrEmpty()]
|
|
[string]$DisplayName = '*'
|
|
)
|
|
|
|
$Services = Get-WmiObject -Class Win32_Service -Filter "StartMode != 'Disabled' and Name like '$($Name -replace '\*', '%')' and DisplayName like '$($DisplayName -replace '\*', '%')'"
|
|
|
|
foreach ($Service in $Services) {
|
|
|
|
if (Test-Path -Path "HKLM:\SYSTEM\CurrentControlSet\Services\$($Service.Name)\TriggerInfo\") {
|
|
|
|
New-Object -TypeName PSObject -Property @{
|
|
Status = $Service.State
|
|
Name = $Service.Name
|
|
DisplayName = $Service.DisplayName
|
|
StartMode = "$($Service.StartMode) (Trigger Start)"
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Get-MrTriggerStartService |