2017-02-23 6 views
-2

Wie kann ich die Ausgabe des Befehls Windows-Format,Netsh Ausgabe im csv mit Powershell

c:\netsh wlan show networks mode=bssid 

als csv unten,

myWifinameA,Infrastructure,WPA2-Personal,CCMP,bc:9c:31:36:05:60,80%,802.11n,10,1 2 5.5 11,6 9 12 18 24 36 48 54 
myWifinameB,Infrastructure,WPA2-Personal,CCMP,d4:61:2e:c6:b2:6e,75%,802.11n,5,1 2,5.5 6 9 11 12 18 24 36 48 54 

versucht dies mit Python als gut, aber ich habe Probleme die Räume loswerden.

+2

See [wlanscan.ps1] (https://gallery.technet.microsoft.com/scriptcenter/Wireless-networks-scanner-938fb966) – wOxxOm

Antwort

0

Building off this functionGet-WifiNetwork

Get-WifiNetwork | select SSID, 'Network Type', Authentication, Encryption, 'BSSID 1' 

Schienen alle Informationen zu sammeln, Sie benötigen.

Incase geht die Verbindung schlecht in furture Funktionscode

function Get-WifiNetwork { 
end { 
    netsh wlan sh net mode=bssid | % -process { 
    if ($_ -match '^SSID (\d+) : (.*)$') { 
     $current = @{} 
     $networks += $current 
     $current.Index = $matches[1].trim() 
     $current.SSID = $matches[2].trim() 
    } else { 
     if ($_ -match '^\s+(.*)\s+:\s+(.*)\s*$') { 
      $current[$matches[1].trim()] = $matches[2].trim() 
     } 
    } 
    } -begin { $networks = @() } -end { $networks|% { new-object psobject -property $_ } } 
} 
}