Link to home
Start Free TrialLog in
Avatar of K B
K BFlag for United States of America

asked on

PowerShell: Where-Object not working as a filter

I can't seem to limit this $userLicenses (without actually explicitly setting it)

What am I missing?

 $userLicenses = $userLicense | ? {$usersku -eq 'contoso:ENTERPRISEPACK'}

Open in new window

$UserLicenses yields all the user's licence SKUs, instead of the one.
Avatar of footech
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What is the value of the $userLicense and $usersku variables?

Here's an example if you were working with objects returned from the Get-MsolAccountSku cmdlet:

Get-MsolAccountSku | Where-Object {$_.accountskuid -eq 'contoso:ENTERPRISEPACK'}

Open in new window