none
Show only value RRS feed

  • Question

  • I'm trying to get the ssid name that i'm connected to.

    When I run command netsh wlan show interfaces | select-string '\sSSID'  in powershell the value is 

    SSID  : Wifi Name.

    is there a way how can I get rid of SSID and promt only the Wifi Name?

    Wednesday, July 19, 2017 11:10 AM

Answers

  • Select-String:


    netsh wlan show interfaces |
      Select-String '\W+SSID\W+:\W(.+)$' |
      ForEach-Object { $_.Matches[0].Group s[1].Value }
    

    Assign to a variable and you have only the SSID.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, July 19, 2017 12:28 PM
    Moderator

All replies

  • Try the split string method:

    ((netsh wlan show interfaces | Select-String -Pattern "\sSSID") -split ": ")[1]
    wizend
    Wednesday, July 19, 2017 11:35 AM
  • Select-String:


    netsh wlan show interfaces |
      Select-String '\W+SSID\W+:\W(.+)$' |
      ForEach-Object { $_.Matches[0].Group s[1].Value }
    

    Assign to a variable and you have only the SSID.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, July 19, 2017 12:28 PM
    Moderator