Graph Week – Exploring the MSGraphAPI Cmdlets

Yesterday, I showed you how to install and start with the MSGraphAPI cmdlets. Today we’re going to explore them and see all that you can do with them!

We learned how to authenticate yesterday, and run the first command: Get-GraphUsers. What does this command return? I can use GetType to see:


It’s not just returning a hash or array, it’s returning a custom class called GraphUser_v1. What is this object? This is a custom object created for the cmdlets that has a number of properties and methods on it.

What are some of the things you can do with it? Here’s a list of all the Get methods on GraphUser_v1 objects:


When I use Get_Manager() on the object, it will query Graph and find the manager of the user object in Azure AD:


Microsoft Graph is an online service, so different environments may have different properties and methods available to them. Classes in the MSGraphAPI cmdlets are not dynamic, so there may be a time when the Graph cmdlets are returning properties that don’t show up in the property list of users. Because of this, all objects have a property called “RawJSON” to be sure data is never lost. If you don’t see the information you are expecting on the object, check RawJSON!

Here’s an example of RawJSON on a user object:


And that’s it for today! You should now know how to start using the Graph cmdlets and be familiar with the object types that are returned. Tomorrow we will look at querying for new items in Graph using Invoke-GraphMethod!

Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *