Cloud PC Usage Report With PowerShell

By | June 27, 2022

Introduction

Knowing how often users connect to their Cloud PC gives you an idea if they are using it or not. From here, you can investigate if there is a reason for a user not to use the Cloud PC as first intended. Ultimately you can track down the users who no longer need a Cloud PC and can save that license cost. as you might know, there is no built-in usage report in the MEM portal. Therefore I have cooperated with Donna Ryan on a PowerShell script that will gather information about login count over a period and the last login date.

Before executing the script

Please get the latest script from the Windows 365 Github Repo and save it as .ps1 file. You can also run it directly from the PowerShell editor.

There are two variables to consider before running the script.

$offset: Define over many days you would like to get the login count. If I want to get the login count for the past week, specify 7 in the parameter.

$logpath: If this parameter is defined, it will output a .csv file to that path.

There will be output in the PowerShell window. It can, however, be challenging to get a complete overview if there are many Cloud PC devices.

Script execution

Running the script is very simple. All the modules needed will automatically be installed. Now you just run the script with the specified parameters as you wish and log in with an administrator account that has access to read Cloud PC and Azure AD device information and read sign-in logs of users in Azure AD.

Final thoughts

Getting a report of login count and last logon time helps to understand the users’ usage of Windows 365. Some users might not use the environment as first intended, maybe because of performance or configuration issues you might never hear about. But now you can look into the usage and better understand if you can free up some licensing costs or investigate with some specific users if there is some configuration that needs to be changed for their usage.

Remember to follow the Windows 365 Github Repo. There are some handy scripts, and I’m sure more will come over time.

7 thoughts on “Cloud PC Usage Report With PowerShell

  1. Pingback: Weekly Newsletter – 25th June to 1st July 2022 - Windows 365 Community

  2. Walter Riopedre

    This report is useful. Thanks. Wondering if there is a way to get the actual usage per user. Like how long were the users connected during the specified period. Like 30 hours in the last 7 days.

    Reply
    1. Morten Pedholt Post author

      Hi Walter,

      That could be really cool. i however dont think it would be possible at the moment to get that data.

      Reply
      1. Egor

        You can. The endpoint for the API call is https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/reports/getTotalAggregatedRemoteConnectionReports The call itself has slightly different semantics than your standard API call. The method is POST and the request body should contain filter and select statements in this format:

        {“top”:100,”skip”:0,”search”:””,”filter”:””,”select”:[“UserPrincipalName”,”TotalUsageInHour”,”DaysSinceLastSignIn”],”groupBy”:[“UserPrincipalName”,”TotalUsageInHour”,”DaysSinceLastSignIn”],”orderBy”:[]}

        The response will echo the requested schema.

        Reply
  3. Sean McNeill

    Morten, great script idea, I am having trouble running it, getting errors on CMDLET names, it appears maybe an update to a Module changed the CMDLET names?
    ping me directly for specifics

    Reply
    1. Morten Pedholt Post author

      Hi Sean,

      Please ping me at twitter @mortenpedholt

      Reply
  4. Aaron K

    This just stopped working for me out of the blue…was a wonderful script. Seems to coincide with when Microsoft made a user usage report (information lacking at that) available from the Intune reports.

    Anyone experiencing the same or have an idea how to restore functionality?

    Reply

Leave a Reply

Your email address will not be published.