Powershell Select-String print between text

Filip 831 Reputation points
2021-03-30T10:04:08.493+00:00

Hello everybody.
I want do something special. This is command which i use in powershell:
netsh wlan show all | Select-String "SSID", "Signal"

But is there way that i can print the string and before will be print next mach i want write my own text.
Explain:

SSID:
Signal:
My text
SSID:
Signal:
My text
...

Thanks for answare

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-03-30T12:05:11.47+00:00

    Hi,

    You can try someting like this.

    netsh wlan show all | ForEach-Object {  
        Select-String -InputObject $_ -Pattern "SSID", "Signal"  
        if($_ -like "*Signal*"){  
            Write-Host 'My text'  
        }  
    }  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.