-
Notifications
You must be signed in to change notification settings - Fork 4
/
Get-ServiceLogon.ps1
16 lines (15 loc) · 1.06 KB
/
Get-ServiceLogon.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<#
.Synopsis
Gets a list of services (including Log On As User information)
.Example
PS> Get-ServiceLogon win
Name StartName State
---- --------- -----
WinDefend LocalSystem Running
WinHttpAutoProxySvc NT AUTHORITY\LocalService Running
Winmgmt localSystem Running
WinRM NT AUTHORITY\NetworkService Running
#>
function Get-ServiceLogon($name) {
gwmi win32_service | select Name, StartName, State | ? Name -match $name
}