Feb 142018

I needed to get all MAC addresses without hyphens today so I could match against some MAC Address barcodes.
Ended up writing this one-liner to get what I needed. I’ve added some variables to make it a bit easier to read here.

$svrDHCP = "DHCP Server"
$scope = ""
Get-DhcpServerv4Lease -ComputerName $svrDHCP -scope $scope | select IPAddress,ClientID,Hostname | ForEach-Object { Add-Member -InputObject $_ -name Mac -MemberType NoteProperty -Value $($_.clientID -replace "-",""); write-output $_} | out-gridview