powershell - Find a list of stopped services using user input wildcard -
I am trying to create a power shell script that, when executed, a specific, user input wildcard. I would like to save the wildcard as a string, then used here in the service that I have done so far.
$ SearchPrefix = $ ("Specify search prefix": ")" go-service | where-object {$ _. Position-eq "stopped"} | where I'm new to learning PowerShell, so I'm a little bit up-to-date and I'm new to learning PowerShell. Any help stuck will be appreciated.
change -ike - match -
-accent is for strict similarity -
-mail pattern A If you ask for a prefix, then add a permutation accent at the beginning: $ _ .name -mail "^ $ SearchPrefix" One side note In the form, your two previous foreach is useless and will block the ouput AFAICS.
gate-service | where-object {$ _. Position-eq "stopped"} | where-object {$ _name-match $ SearchPrefix} The output will be something like this
Status Name DisplayName ------ --- - --- -------- Closed WinHttpAutoProx ... Service DD © Quarte Automatic Mr. ... Stop WinRM Gestion distance of a Windows (Gest ... If you only want two first column,
| Add Format-Table-Health-Property Status, Name
Comments
Post a Comment