I am new to powershell and coding in general. I Have been asked to write a code with specific details that sends an email out to someone. I am 90% complete. One of the details is asking for an IP address and I have managed to find the IP but when the email is sent it comes out like @{IPV4Address=10.240.47.197}. Any suggestions on how to getting just the IP and not the ip4 blah.
The current code i have that collects the IP is
$ipaddress = Test-Connection $serverName -count 1 | select Ipv4Address
$servString += FormatCell -cellValue $ipaddress
Would Really appreciate the help
thanks
Osman
You need to call the IPV4Address
property, so $ipaddress.IPV4Address
, or something. Something like:
$ipaddress = Test-Connection $serverName -count 1
$servString += FormatCell -cellValue $ipaddress.IPV4Address.IPAddressToString