Adding a text line to a select object from get-content

by link12 at 2012-10-09 12:56:06

$a = get-content c:\testasyncusers.txt

foreach ($i in $a) {
Get-ActiveSyncDeviceStatistics -Mailbox $i | select $i,DeviceOS,DeviceModel,DeviceType
}

I’m trying to have each line item from the get-content line show up as an object in my select statement. Any help would be awesome?
by DonJ at 2012-10-09 13:02:03

$a = get-content c:\testasyncusers.txt

foreach ($i in $a) {
$stats = Get-ActiveSyncDeviceStatistics -Mailbox $i
$props = @{‘Mailbox’=$i;‘DeviceOS’=$stats.DeviceOS;‘DeviceModel’=$stats.DeviceModel;‘DeviceType’=$stats.DeviceType}
New-Object PSObject -prop $props
}


Like that?
by link12 at 2012-10-09 14:23:59
That did it. Thanks for the quick reply. I’m off to build the iOS 6 report. :slight_smile: