usr/Get-TriggeredService.ps1
function Get-TriggeredService { [CmdletBinding()]param() end { (Get-ChildItem HKLM:\SYSTEM\CurrentControlSet\Services).Where{ $_.GetSubKeyNames() -contains 'TriggerInfo' }.ForEach{ $top = $_.OpenSubKey('TriggerInfo') $srv = Get-Service -Name (Split-Path -Leaf $_.Name) [PSCustomObject][Ordered]@{ Name = $srv.Name User = $srv.UserName Description = $srv.Description DependentServices = $srv.DependentServices RequiredServices = $srv.RequiredServices StartType = $srv.StartType Status = $srv.Status Triggers = $( foreach ($sub in $top.GetSubKeyNames()) { $inf = $_.OpenSubKey("TriggerInfo\$($sub)") [PSCustomObject]@{ GUID = [Guid]::new($inf.GetValue('Guid')) Type = $inf.GetValue('Type') } $inf.Dispose() }) } $srv.Dispose() $top.Dispose() $_.Dispose() } } } Export-ModuleMember -Function Get-TriggeredService |