Fetch all data within Office 365 Groups

An O365 Administrator has the right and the duty of managing all the users in the portal. By running this script, a Global Admin can set parameters and at once fetch any data they need from all the groups present in O365. 

The script will connect to Azure AD (Active Directory) first and extract details of each group present in the directory.

The admin can change the parameters as per need and decide on what the output will be. The output will be exported in a .CSV file and will be stored in C Drive. You can also change the storage location path and the file name too. 

 

How to Run the “Fetch all O365 Details” script : 

Step 1 

Open PowerShell as an Administrator 

 

Step 2 

Write command Connect-AzureAD. Press Enter 

 

Step 3 

Post this step, a login window will pop up in which you need to enter the credentials of the organization for whom you need to pull out the data or report

Script- O365 login

Step 4 

Once you successfully log in or connect to AzureAD for your respective user or Organization you can get the information about the Account in which you are logged in, environment, Tenant ID etc… 

Script- O365 Step 4

 

 

Step 5 

After that, you need to copy and paste the script into PowerShell and press enter. 

NOTE:  This is when you can choose the location path for the .CSV file. Mentioned below in ScreenShot. 

Step 5

 

 

Step 6 

Once the script runs successfully, the .CSV file storage path will automatically show up in PowerShell. Once you hit enter, your chosen file name will be exported to the chosen storage path accordingly. 

In this case, we have set C: Drive for file storage and set DATAforBLOG as a file name.

Step 6

 

Script Hub
-Explore a library of free Powershell Scripts

To find more such useful PowerShell Scripts, head over to Script Hub in our Resources Section.

 

Nirav Shah
Nirav Shah

Nirav leads technical initiatives at Infrassist that supports MSPs business and crafts services/solutions that help customers improve their overall service quotient. He enjoys working and knowing about technology while handling all the customers with a great level of business acumen.

Thanks For Reading