Getting information about your IP address is easy in Powershell.
Below is a simple example, this is printing information about the IP addresses on the system.
PS C:\Users\Jim\Pictures\Saved Pictures> Get-NetIPAddress |Select-Object IPAddress IPAddress --------- fec0::6155:1c09:8069:d506%1 fe80::6155:1c09:8069:d506%7 ::1 10.0.2.15 127.0.0.1 |
This is a bit long, but this is how to get just the IPv4 IP address of your machine.
PS C:\Users\Jim\Pictures\Saved Pictures> Get-NetIPAddress | Where-Object {$_.AddressFamily -eq "ipv4" -and $_.IPAddress -ne "127.0.0.1"} | Select-Object IPAddress IPAddress --------- 10.0.2.15 |
This is a version to get the IPv6 IP addresses.
PS C:\Users\Jim\Pictures\Saved Pictures> Get-NetIPAddress | Where-Object {$_.AddressFamily -eq "ipv6" -and $_.IPAddress -ne "::1"} | Select-Object IPAddress IPAddress --------- fec0::6155:1c09:8069:d506%1 fe80::6155:1c09:8069:d506%7 |
This is another way to get just the IP address of the machine.
PS C:\Users\Jim\Pictures\Saved Pictures> Get-NetIPConfiguration | Select-Object IPv4Address IPv4Address ----------- {10.0.2.15} |
Powershell treating all things as objects makes scripting quite easy, once you get the hang of filtering by objects, it is simple to get just one thing out of a lot of input.
You may also get information about stopped services and match a certain process name.
PS C:\Users\Jim\Pictures\Saved Pictures> Get-Service | Where-Object {$_.Status -eq "Stopped" -and $_.DisplayName -Match "Hyper-V"} Status Name DisplayName ------ ---- ----------- Stopped vmicguestinterface Hyper-V Guest Service Interface Stopped vmicheartbeat Hyper-V Heartbeat Service Stopped vmickvpexchange Hyper-V Data Exchange Service Stopped vmicrdv Hyper-V Remote Desktop Virtualizati... Stopped vmicshutdown Hyper-V Guest Shutdown Service Stopped vmictimesync Hyper-V Time Synchronization Service Stopped vmicvmsession Hyper-V PowerShell Direct Service Stopped vmicvss Hyper-V Volume Shadow Copy Requestor |
This is good for keeping track of certain processes on a Windows 10 desktop or server.
It is even possible to use wildcards, like this trick.
PS C:\Users\Jim\Pictures\Saved Pictures> Get-Service | Where-Object {$_.Status -eq "Running" -and $_.DisplayName -Match "Windows [A-D]"} Status Name DisplayName ------ ---- ----------- Running AudioEndpointBu... Windows Audio Endpoint Builder Running Audiosrv Windows Audio Running mpssvc Windows Defender Firewall Running Wcmsvc Windows Connection Manager |
This is printing all running processes that match the word “Windows” and then after it all letters from A to D. So it will only print the words from Audio to Connection.