I’m pretty familiar with PHP, Javascript, etc but I’m new to Powershell. I’m trying to get IP addresses and Mac addresses from all the computer’s in an active directory. I came across a script that gets an object with all the computer names a lists them through a foreach loop. Inside that loop, I’m trying to run the following:
$colItems = GWMI -cl "Win32_NetworkAdapterConfiguration" -name "root\CimV2" `
comp $objComputer.name -filter "IpEnabled = TRUE"
Obviously, this isn’t working since it can’t take data from the pipeline. Is there away to take the name property and convert it into a string variable to use within the Get-WmiObject? I’ve tried declaring a string variable with that $objComputer.name as the value and tried $($objComputer.name), but neither did it for me. Any help would be greatly appreciated.
i think you need a hyphen in front of comp…
that could be a copy and paste error…
This works for me though (using a dot):
using $objComputer though you could do this
Matt