New-MVQuery to support search of object class
dminnelli opened this issue · 6 comments
Hi Ryan,
New-MVQuery can query MV objects based on a search criteria, but can't seem to query and return all objects of a particular object class without applying a search criteria which would be a nice addition, similar to what you can do in the console under Metaverse Search.
Also your link to https://github.com/lithnet/miis-powershell/wiki/New-MVQuery doesn't find the page, although full help in PowerShell does work - 'get-help New-MVQuery'.
Dave
Thanks for reporting this David,
Sorry for the delay in the response.
I've added the missing New-MVQuery page to the wiki. Working on the object class search now.
Package has been updated. Should be as simple as
Get-MVObject -ObjectType user
Let me know if you are happy and I'll close the issue
Ryan
That's awesome. It is now possible to scope Get-MVObject by objectclass.
$mvschema = Get-MVSchema
$userOC = $mvschema.ObjectClasses.person.Name
$user = Get-MVObject -ObjectType $userOC -Attribute accountName -Value drobinson
$displayName = $user.Attributes.displayName.Values
$displayName
This makes it as powerfull as the Metaverse Search where you can select "Scope by Object Type".
Thx Ryan.
Hey Ryan,
Thanks for looking into it. Sorry I haven't been able to test this until now, but in my scenario the update you have made it not working as expected. I'm wanting to return all Sync Rules with this command 'Get-MVObject -ObjectType synchronizationRule' and it returns duplicate results. I have 18 Sync Rules in my environment and it returns 36. I'm getting the same querying other object types such as 'person'. I haven't looked through the source code yet, but are you able to reproduce this?
Cheers
Dave
Sorry! Fixed in 6351.
https://github.com/lithnet/miis-powershell/releases/tag/v1.0.6351
Thanks Ryan. Now works as expected. Great work :)