Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove multiple signinlog queries #30

Open
sellarsm1 opened this issue Mar 17, 2023 · 1 comment
Open

remove multiple signinlog queries #30

sellarsm1 opened this issue Mar 17, 2023 · 1 comment

Comments

@sellarsm1
Copy link

Thanks for this code, it really helped me know where to look for this data.

I found that the signinlog query that get's repeated for each CloudPC user can be moved outside the loop with this command:

$logons = Get-MgAuditLogSignIn -Filter "startswith(devicedetail/displayname, 'CPC-') and appdisplayname eq 'Windows Sign In' and createdDateTime gt $string"

This allows the removal of the 2 second sleep, so the script completes much more quickly.

Also, I believe that -all should be added to the CloudPC query in case the number grows beyond 100.
$cloudPCs = Get-MgDeviceManagementVirtualEndpointCloudPC -all

Thanks again,
Martin

@DonnaRyanMicrosoft
Copy link
Contributor

Thanks for the tip Martin. I'll take a look at that :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants