Powershell Select-String print between text

Filip 831 Reputation points

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.

My text
My text

Thanks for answare

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
4,621 questions
No comments
{count} votes

Accepted answer
  1. Ian Xue (Shanghai Wicresoft Co., Ltd.) 18,351 Reputation points Microsoft Employee


    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