# Get IP / Nework Info try { $computerPubIP=(Invoke-WebRequest ipinfo.io/ip -UseBasicParsing).Content } catch { $computerPubIP="Error getting Public IP" } $computerIP = get-WmiObject Win32_NetworkAdapterConfiguration|Where {$_.Ipaddress.length -gt 1} $IsDHCPEnabled = $false $Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "DHCPEnabled=$True" | ? {$_.IPEnabled} foreach ($Network in $Networks) { If($network.DHCPEnabled) { $IsDHCPEnabled = $true } [string[]]$computerMAC =$Network.MACAddress } # Get Network Interfaces $Network = Get-WmiObject Win32_NetworkAdapterConfiguration | where { $_.MACAddress -notlike $null } | select Index, Description, IPAddress, DefaultIPGateway, MACAddress | Format-Table Index, Description, IPAddress, DefaultIPGateway, MACAddress # Get wifi SSIDs and Passwords $WLANProfileNames =@() #Get all the WLAN profile names $Output = netsh.exe wlan show profiles | Select-String -pattern " : " #Trim the output to receive only the name Foreach($WLANProfileName in $Output){$WLANProfileNames += (($WLANProfileName -split ":")[1]).Trim()} $WLANProfileObjects =@() #Bind the WLAN profile names and also the password to a custom object Foreach($WLANProfileName in $WLANProfileNames){ #get the output for the specified profile name and trim the output to receive the password if there is no password it will inform the user try{ $WLANProfilePassword = (((netsh.exe wlan show profiles name="$WLANProfileName" key=clear | select-string -Pattern "Key Content") -split ":")[1]).Trim() }Catch{ $WLANProfilePassword = "The password is not stored in this profile" } #Build the object and add this to an array $WLANProfileObject = New-Object PSCustomobject $WLANProfileObject | Add-Member -Type NoteProperty -Name "ProfileName" -Value $WLANProfileName $WLANProfileObject | Add-Member -Type NoteProperty -Name "ProfilePassword" -Value $WLANProfilePassword $WLANProfileObjects += $WLANProfileObject Remove-Variable WLANProfileObject } "Network: " "==================================================================" "Computers MAC address: " + $computerMAC "Computers IP address: " + $computerIP.ipaddress[0] "Public IP address: " + $computerPubIP "W-Lan profiles: " "=================================================================="+ ($WLANProfileObjects| out-string) pause