Issue
Code backup
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
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
|
||||
Reference in New Issue
Block a user