Get-NetworkAdapterConnectionStatus: Unterschied zwischen den Versionen
Aus Wiki-WebPerfect
Admin (Diskussion | Beiträge) |
Admin (Diskussion | Beiträge) |
||
(Eine dazwischenliegende Version des gleichen Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
+ | <span style="font-size:20px;"><span style="color:red">'''-> This function/script is moved to [https://github.com/R-Studio/PSTools GitHub]!'''</span></span><br> | ||
+ | |||
<source lang="powershell"> | <source lang="powershell"> | ||
− | Function Get- | + | Function Get-NetworkAdapterConnectionStatus { |
param( | param( | ||
$ComputerName=$env:computername | $ComputerName=$env:computername |
Aktuelle Version vom 21. Februar 2020, 17:21 Uhr
-> This function/script is moved to GitHub!
Function Get-NetworkAdapterConnectionStatus { param( $ComputerName=$env:computername ) $statushash = @{ 0 = "Disconnected" 1 = "Connecting" 2 = "Connected" 3 = "Disconnecting" 4 = "Hardware not present" 5 = "Hardware disabled" 6 = "Hardware malfunction" 7 = "Media Disconnected" 8 = "Authenticating" 9 = "Authentication Succeeded" 10 = "Authentication Failed" 11 = "Invalid Address" 12 = "Credentials Required" } $networks = Gwmi -Class Win32_NetworkAdapter -ComputerName $computername $networkName = @{name="NetworkName";Expression={$_.Name}} $networkStatus = @{name="Networkstatus";Expression=` {$statushash[[int32]$($_.NetConnectionStatus)]}} foreach ($network in $networks) { $network | select $networkName, $Networkstatus } }
Source: https://techibee.com/powershell/powershell-get-network-adapter-connection-status/1143