Hi Prakash Kumar Singh,
Thank you for posting in the Q&A Forums.
Below is a general step-by-step guide to help you generate the required reports using PowerShell:
Getting guest user information using SharePoint Online Management Shell:
First, make sure you have SharePoint Online Management Shell installed.
Connect to your SharePoint Online tenant using the Connect-SPOService command.
Use commands such as Get-SPOSite and Get-SPOUser to get guest user information for a specific site or all sites.
Track guest access expiration dates:
The guest user's access expiration date can usually be found in the properties of the user object, but it depends on your SharePoint and Azure AD configuration.
If the guest expiration policy has been set in Azure AD or SharePoint, you may need to query Azure AD to get this information.
Use the Microsoft Graph API for more detailed guest information:
Register an Azure AD application to access the Graph API.
Use the Graph API to query the guest user and details of their access rights, including expiration dates.
You may need to write a PowerShell script to automate this process and use the Graph API's authentication token to access the data.
Generate reports:
Based on the data you've collected, use a PowerShell script to generate a report listing the guest users who have lost access and those who will lose access in the future.
You can export the report as a CSV or Excel file for easier analysis and sharing.
Caution:
Make sure you have sufficient permissions to access and query the required data.
Follow relevant privacy and security policies when handling sensitive data.
Regularly update and test your scripts to ensure they work properly with updates to your Microsoft 365 environment.
Best regards
NeuviJ
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.