Thứ Năm, 26 tháng 7, 2018

Get Services with path to executable export to csv of windows

Powershell
Get-Service
Example 1: Get all services on the computer
Get-Service
This command gets all of the services on the computer. It behaves as though you typed Get-Service *. The default display shows the status, service name, and display name of each service.

Example 2: Get services that begin with a search string
Get-Service "wmi*"
This command retrieves services with service names that begin with WMI (the acronym for Windows Management Instrumentation).

Example 3: Display services that include a search string
Get-Service -Displayname "*network*"
This command displays services with a display name that includes the word network. Searching the display name finds network-related services even when the service name does not include "Net", such as xmlprov, the Network Provisioning Service.

Example 4: Get services that begin with a search string and an exclusion
Get-Service -Name "win*" -Exclude "WinRM"
These commands get only the services with service names that begin with win, except for the WinRM service.

Example 5: Display services that are currently active
Get-Service | Where-Object {$_.Status -eq "Running"}
This command displays only the services that are currently active. It uses the Get-Service cmdlet to get all of the services on the computer. The pipeline operator (|) passes the results to the Where-Object cmdlet, which selects only the services with a Status property that equals Running.

Get Services with path to executable export to csv of windows:

Get-WmiObject win32_service | ?{$_.Name -like '*'} | select Name, Pathname, State, StartMode, StartName | export-csv "C:\Services.csv" -NoTypeInformation -Encoding UTF8

Share This!


Không có nhận xét nào:

Đăng nhận xét