I have a simple powershell script to capture IP Addresses from SCCM server by the MAC addresses list, like that:
$ServerName = Get-Content "C:\suport\macs.txt"
foreach ($Server in $ServerName) {
$maq = (Get-WmiObject -Namespace "root/SMS/Site_G01" -ComputerName SCCMSERVERr -class SMS_R_System -filter "MACAddresses like '$Server'").IPAddresses
Write-Output $maq
}
But, the output is IPV4 + IPV6 addresses...:
...
172.10.20.155
fe76::4112:5ecd:bfe2:10ff
172.10.15.158
fe76::e098:d709:5cce:d09c
...
I need only the IPV4 output, like that:
...
172.10.20.155
172.10.15.158
...
Can you help me? Thanks a lot! :)