Forum Discussion
JJGuirola
Microsoft
Mar 02, 2023How to Automate Windows 365 Cloud PC Last Login monitoring!
Automate Windows 365 Cloud PC Last Login monitoring!
(Windows 365, Azure Active Directory, Power Automate, MS Graph)
Contributors:
Juan José Guirola Sr. (Next Generation Endpoint GBB for Am...
Dawn M Wertz
Mar 20, 2023Brass Contributor
hello. Thank you for the article. We are not licensed for Power Automate, so I am attempt to do these steps in PowerShell. when I tested the connections in the Graph Explorer, I do not see the lastRemoteActionResult and lastLoginResult properties on the https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs?
In Graph Explorer, when i run a query of all Cloud PCs these properties are not returned. I tried running
https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs?$select=userprincipalname,id,managedDeviceName,lastRemoteActionResult,lastLoginResult
and the lastLoginResult and lastRemoteActionResult is null for all items.
do you have any advice on how to pull the information?
In Graph Explorer, when i run a query of all Cloud PCs these properties are not returned. I tried running
https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs?$select=userprincipalname,id,managedDeviceName,lastRemoteActionResult,lastLoginResult
and the lastLoginResult and lastRemoteActionResult is null for all items.
do you have any advice on how to pull the information?
- JJGuirolaMar 20, 2023
Microsoft
Hi Dawn. Pay attention to the steps 4 - 5 right under Figure 10 of the article. To get those values for each Cloud PC, you will have to Parse through each Cloud PC and extract that value to a variable. That value is returned as NULL when doing a bulk request, but if you isolate the query to specific Cloud PC id, you will get the necessary value. Hope that helps.- Robin_HerbertApr 04, 2025Copper Contributor
Hi Juan José!
Useful example, although I can't help wondering why you included returning the lastRemoteActionResult and lastLoginResult properties in the first GET (when all Cloud PCs are returned) when you then state (correctly) that those values will always be NULL?
Also, looks like the lastLoginResult is now (or was it then?) either Null, or has a sub-value of Time. So need to parse down one more layer to get that value for comparison. e.g.:"body": { "@odata.context": "https://graph.microsoft.com/beta/$metadata#deviceManagement/virtualEndpoint/cloudPCs(userPrincipalName,id,displayName,managedDeviceName,status,imageDisplayName,lastModifiedDateTime,lastLoginResult,provisioningPolicyName,servicePlanName)/$entity", "id": "0cac010b-e5ff-49c4-a097-dc60eb2da45a", "displayName": "cloudpc-prd-weu - username", "imageDisplayName": "Windows 11 Enterprise + Microsoft 365 Apps 22H2", "provisioningPolicyName": "cloudpc-prd-weu", "servicePlanName": "Cloud PC Enterprise 4vCPU/16GB/128GB", "status": "provisioned", "userPrincipalName": "userUPN", "lastModifiedDateTime": "2025-04-04T11:30:50Z", "managedDeviceName": "CPC-abcde-F62IJ", "lastLoginResult": { "time": "2025-04-04T09:16:58.8915555Z" } }
(returned values changed a little to protect my org.)
I also found you could just do the 'div' action upon the lastLoginResult.Time value directly, without the additional compose action. Saves a few actions!