Capture the SSID name and MAC address and then reshape the output to text (how to format plain text content into PowerShell-friendly format:)

Source: Internet
Author: User
Tags bssid

$raw = netsh wlan show network mode=Bssid$ssids= $raw | Select-string-pattern'ssid\b'| Select-string-pattern'\bbssid\s[^1]\b'-notmatch | foreach-Object {$_. ToString (). PadRight ( One) +'_'#有些扫描出来的SSID没有名字, so I'll simply have all SSOD names followed by an underscore to ensure subsequent formatting is correct} $ssids 2= $ssids-Split '\b\s\d{1,}\s{1,}[:]\s+\b'|Select-string-pattern'ssid\b'-notmatch #分割字符, SSID | <SSIDNAME> | BSSID | <mac address> for($i =0; $i-lt $ssids 2. Count; $i = $i +2) {# $ssids 2[$i]. ToString (). Substring (0, $ssids 2[$i]. ToString (). length-1) # $ssids 2[$i+1]. ToString (). Substring (0, $ssids 2[$i +1]. ToString (). length-1) [Pscustomobject]@{ssidname= $ssids 2[$i]. ToString (). Substring (0, $ssids 2[$i]. ToString (). length-1); macaddress= $ssids 2[$i +1]. ToString (). Substring (0, $ssids 2[$i +1]. ToString (). length-1)} #| Export-csv-path ('f:\ ' + (get-date). Hour.tostring () + (get-date). Minute.tostring () + (get-date). Minute.tostring () +'. csv')-encoding default-append-notypeinformation}

Capture the SSID name and MAC address and then reshape the output to text (how to format plain text content into PowerShell-friendly format:)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.