Jump to content

i have this line of code: 

 

 # save computer name in variable 'computerName' for readability..    $computerName = $env:computername;     # print information    Get-WmiObject -ComputerName $computerName Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null } | Out-GridView -Title "Network information"; 
 

which opens a window and displaying info of the network adapters but how do i exclude some of the stuff like if i ONLY want to see IP-address and Gateway in the window there? is there a command to only make it include some of the categories?

Edited by alpenwasser
code tags

AMD Ryzen 9950X3D [x2 360 Rad EKWB] | Asus Extreme x670E | RTX STRIX 5090 OC@3GHz [Alpha Block] | Corsair HX1500i | G.Skill Neo CL30 6000MHz (2x32GB) | Samsung 9100PRO 8TB Gen5 + MP700 2TB Gen5 + 980/950 Pro 1TB M.2 | x6 85PRO 512GB | NAS@10Gbit/s 4x 24TB Seagate Exo Raid 10 (2x 1TB raid 1 NVME Cache) - 4x 1TB NVMe Raid 0 + Backblaze | Lian-Li o11D XL | Main Screen: Samsung OLED G9 | AUX: LG IPS7 27" (x2) LG CX 55" G-Sync | 10Gbit/s ISP connection | Copyright©1996-2026 Teletha All rights reserved. ®

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/
Share on other sites

Link to post
Share on other sites

 

i have this line of code: 

 

 # save computer name in variable 'computerName' for readability..
    $computerName = $env:computername;
 
    # print information
    Get-WmiObject -ComputerName $computerName Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null } | Out-GridView -Title "Network information";
 
 
which opens a window and displaying info of the network adapters but how do i exclude some of the stuff like if i ONLY want to see IP-address and Gateway in the window there? is there a command to only make it include some of the categories?

 

ipconfig /all.  All you need. 

CPU: AMD Ryzen 5 5600X | CPU Cooler: Stock AMD Cooler | Motherboard: Asus ROG STRIX B550-F GAMING (WI-FI) | RAM: Corsair Vengeance LPX 32 GB (4x 8 GB) DDR4-3000 CL16 | GPU: Nvidia GTX 1060 6GB Zotac Mini | Case: K280 Case | PSU: Cooler Master B600 Power supply | SSD: 1TB  | HDDs: 1x 250GB & 1x 1TB WD Blue | Monitor: 24" Acer S240HLBID | OS: Win 11 Pro.

 

Home Lab:  Lenovo ThinkCenter M82 Hyper-V Server 2022 | Dell OptiPlex 9020 Hyper-V Server 2022 | TP-LINK TL-SG108E | Cisco Catalyst C2960CG 8 Port Switch | HP MicroServer G8 SCCM Server | 2x Dell PowerEdge R630 Hyper-V Server 2022

 

 

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/#findComment-5068679
Share on other sites

Link to post
Share on other sites

ipconfig /all.  All you need. 

 

no i need to learn how to do this

AMD Ryzen 9950X3D [x2 360 Rad EKWB] | Asus Extreme x670E | RTX STRIX 5090 OC@3GHz [Alpha Block] | Corsair HX1500i | G.Skill Neo CL30 6000MHz (2x32GB) | Samsung 9100PRO 8TB Gen5 + MP700 2TB Gen5 + 980/950 Pro 1TB M.2 | x6 85PRO 512GB | NAS@10Gbit/s 4x 24TB Seagate Exo Raid 10 (2x 1TB raid 1 NVME Cache) - 4x 1TB NVMe Raid 0 + Backblaze | Lian-Li o11D XL | Main Screen: Samsung OLED G9 | AUX: LG IPS7 27" (x2) LG CX 55" G-Sync | 10Gbit/s ISP connection | Copyright©1996-2026 Teletha All rights reserved. ®

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/#findComment-5068686
Share on other sites

Link to post
Share on other sites

no i need to learn how to do this

Oh fail. My bad. I was thinking of something else. What code are you using?

CPU: AMD Ryzen 5 5600X | CPU Cooler: Stock AMD Cooler | Motherboard: Asus ROG STRIX B550-F GAMING (WI-FI) | RAM: Corsair Vengeance LPX 32 GB (4x 8 GB) DDR4-3000 CL16 | GPU: Nvidia GTX 1060 6GB Zotac Mini | Case: K280 Case | PSU: Cooler Master B600 Power supply | SSD: 1TB  | HDDs: 1x 250GB & 1x 1TB WD Blue | Monitor: 24" Acer S240HLBID | OS: Win 11 Pro.

 

Home Lab:  Lenovo ThinkCenter M82 Hyper-V Server 2022 | Dell OptiPlex 9020 Hyper-V Server 2022 | TP-LINK TL-SG108E | Cisco Catalyst C2960CG 8 Port Switch | HP MicroServer G8 SCCM Server | 2x Dell PowerEdge R630 Hyper-V Server 2022

 

 

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/#findComment-5068695
Share on other sites

Link to post
Share on other sites

Oh fail. My bad. I was thinking of something else. What code are you using?

 the one above

AMD Ryzen 9950X3D [x2 360 Rad EKWB] | Asus Extreme x670E | RTX STRIX 5090 OC@3GHz [Alpha Block] | Corsair HX1500i | G.Skill Neo CL30 6000MHz (2x32GB) | Samsung 9100PRO 8TB Gen5 + MP700 2TB Gen5 + 980/950 Pro 1TB M.2 | x6 85PRO 512GB | NAS@10Gbit/s 4x 24TB Seagate Exo Raid 10 (2x 1TB raid 1 NVME Cache) - 4x 1TB NVMe Raid 0 + Backblaze | Lian-Li o11D XL | Main Screen: Samsung OLED G9 | AUX: LG IPS7 27" (x2) LG CX 55" G-Sync | 10Gbit/s ISP connection | Copyright©1996-2026 Teletha All rights reserved. ®

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/#findComment-5068703
Share on other sites

Link to post
Share on other sites

 the one above

Fail, I was meant to say, language. :P

CPU: AMD Ryzen 5 5600X | CPU Cooler: Stock AMD Cooler | Motherboard: Asus ROG STRIX B550-F GAMING (WI-FI) | RAM: Corsair Vengeance LPX 32 GB (4x 8 GB) DDR4-3000 CL16 | GPU: Nvidia GTX 1060 6GB Zotac Mini | Case: K280 Case | PSU: Cooler Master B600 Power supply | SSD: 1TB  | HDDs: 1x 250GB & 1x 1TB WD Blue | Monitor: 24" Acer S240HLBID | OS: Win 11 Pro.

 

Home Lab:  Lenovo ThinkCenter M82 Hyper-V Server 2022 | Dell OptiPlex 9020 Hyper-V Server 2022 | TP-LINK TL-SG108E | Cisco Catalyst C2960CG 8 Port Switch | HP MicroServer G8 SCCM Server | 2x Dell PowerEdge R630 Hyper-V Server 2022

 

 

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/#findComment-5068734
Share on other sites

Link to post
Share on other sites

Fail, I was meant to say, language. :P

 

oh well in powershell ISE im not so good with programming .. have no idea what language it is if not powershell is enough =/

AMD Ryzen 9950X3D [x2 360 Rad EKWB] | Asus Extreme x670E | RTX STRIX 5090 OC@3GHz [Alpha Block] | Corsair HX1500i | G.Skill Neo CL30 6000MHz (2x32GB) | Samsung 9100PRO 8TB Gen5 + MP700 2TB Gen5 + 980/950 Pro 1TB M.2 | x6 85PRO 512GB | NAS@10Gbit/s 4x 24TB Seagate Exo Raid 10 (2x 1TB raid 1 NVME Cache) - 4x 1TB NVMe Raid 0 + Backblaze | Lian-Li o11D XL | Main Screen: Samsung OLED G9 | AUX: LG IPS7 27" (x2) LG CX 55" G-Sync | 10Gbit/s ISP connection | Copyright©1996-2026 Teletha All rights reserved. ®

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/#findComment-5068746
Share on other sites

Link to post
Share on other sites

use the select-object command.

 

 # save computer name in variable 'computerName' for readability..    $computerName = $env:computername;    # print information    Get-WmiObject -ComputerName $computerName Win32_NetworkAdapterConfiguration | Where-Object { $_.IPAddress -ne $null } | Select-Object -Property IPAddress,DefaultIPGateway | Out-GridView -Title "Network information";

Keep in mind that Powershell will not display all properties, use get-member to see all then use select the one you are after with select-object.

Link to comment
https://linustechtips.com/topic/374742-powershell-help-fast/#findComment-5073385
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×