Forum Discussion
JJGuirola
Mar 02, 2023Microsoft
How 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...
bhvorst
Dec 19, 2023Copper Contributor
Hello, could it be that something has changed in the meantime on Microsoft graph side of things?
I am only getting null values back on for lastRemoteActionResult and lastLoginResult when running the action in step 5, all the other property values seem to be correct.
https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs? $select=userprincipalname,id,displayName,managedDeviceName,Status,imageDisplayName,lastModifiedDateTime,lastRemoteActionResult,lastLoginResult
I figured I try the same from the PowerShell function Get-MgBetaDeviceManagementVirtualEndpointCloudPc
Get-MgBetaDeviceManagementVirtualEndpointCloudPc | select-object userprincipalname,id,displayName,managedDeviceName,Status,imageDisplayName,lastModifiedDateTime,lastRemoteActionResult,lastLoginResult
which returns this for all records.
Status : provisioned
ImageDisplayName : Windows 11 Enterprise + Microsoft 365 Apps 22H2
LastModifiedDateTime : 11/1/2023 4:01:15 PM
LastRemoteActionResult : Microsoft.Graph.Beta.PowerShell.Models.MicrosoftGraphCloudPcRemoteActionResult
LastLoginResult : Microsoft.Graph.Beta.PowerShell.Models.MicrosoftGraphCloudPcLoginResult
I am kind of stuck when the LastLoginResult cannot be retrieved.
Thanks in advance.
I am only getting null values back on for lastRemoteActionResult and lastLoginResult when running the action in step 5, all the other property values seem to be correct.
https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs? $select=userprincipalname,id,displayName,managedDeviceName,Status,imageDisplayName,lastModifiedDateTime,lastRemoteActionResult,lastLoginResult
I figured I try the same from the PowerShell function Get-MgBetaDeviceManagementVirtualEndpointCloudPc
Get-MgBetaDeviceManagementVirtualEndpointCloudPc | select-object userprincipalname,id,displayName,managedDeviceName,Status,imageDisplayName,lastModifiedDateTime,lastRemoteActionResult,lastLoginResult
which returns this for all records.
Status : provisioned
ImageDisplayName : Windows 11 Enterprise + Microsoft 365 Apps 22H2
LastModifiedDateTime : 11/1/2023 4:01:15 PM
LastRemoteActionResult : Microsoft.Graph.Beta.PowerShell.Models.MicrosoftGraphCloudPcRemoteActionResult
LastLoginResult : Microsoft.Graph.Beta.PowerShell.Models.MicrosoftGraphCloudPcLoginResult
I am kind of stuck when the LastLoginResult cannot be retrieved.
Thanks in advance.
JJGuirola
Jan 19, 2024Microsoft
Hi.
Try appending the id of one of your CPCs to your query.
https://graph.microsoft.com/beta/deviceManagement/virtualEndpoint/cloudPCs/PUT YOUR CPC ID HERE? $select=userprincipalname,id,displayName,managedDeviceName,Status,imageDisplayName,lastModifiedDateTime,lastRemoteActionResult,lastLoginResult
The reason why you are getting NULLS on these attributes is a result of doing a bulk query. To get the values, you have to isolate the query to each individual CPC. This is why in the article I provide the steps to parse through each CPC and extract the lastLoginResult attribute value to a variable. HTH.