I am developing a Powershell app for my company to allow our Help Desk to get some details quickly to copy into a ticket. I have the following commands which appears to work and get the desired result
(Get-NetIPaddress -InterfaceAlias Ethernet*).IPv4Address
(Get-NetIPaddress -InterfaceAlias Wireless*).IPv4Address
My issue is if I disconnect the ethernet cable or from the wireless and then re-run the command, I still get the IP addresses I got when I ran the command while connected and cannot find a way to clear this or to read this live.
I would prefer to keep the Wireless and wired IP Address separate, but is anyone able to suggest a way in which I can keep this to the current IP address (or show nothing if disconnected) and only give me the IP address, no other text.
Thank you in advance of any help you may be able to provide
This is not a PowerShell issue. It is a DHCP lease specification.
One a nic gets issues an IPA, it will maintain that for the length of time set by policy or until dhcp releases or you manually remove it.
The old faithful DOS approach
You must be logged in to reply to this topic.