Featured Scripts

Featured Tips

Featured Tutorials

How to manage Enterprise environments - Part 3 - Bulk management using multiple filters

Tutorials in this series - 
How to manage Enterprise environments - Part 1 - Filtering queries - Link
How to manage Enterprise environments - Part 2 - Creating scripts with a filtered query - Link
How to manage Enterprise environments - Part 3 - Bulk management using multiple filters - Link

-----------------------------------------------------------------------------------------

How to manage Enterprise environments
Part 3 - Bulk management using multiple filters


In my previous tutorials I have showed you -
- How to create basic PowerShell scripts with Export-CSV - Link
- How to create basic PowerShell scripts with Import-CSV - Link

- How to create basic PowerShell scripts with a Filtered query - Link

In this tutorial, I am going to show you how to join all this knowledge to -
- Use a filtered query script to target certain users and create a csv file

- Import that csv file to generate targeted reports and targeted bulk administration
- Filter the output in the csv for targeted reports where necessary.

I will be creating a few examples of how to perform bulk management of users by creating filtered csv files that are then imported to scripts.

--------------------------------------------------------------------------------------------

*** Process that is used in each example ***

Step 1 - Create a script to create a filtered csv to use for importing
- Create the script to filter via CustomAttribute, RecipientType, AD Attribute (Office) etc.
- Export and save the csv to be imported in the second script

Step 2A -  Filter the csv to only show the results needed (if needed)
- Example - filter the csv to only show Shared mailboxes, save as new csv. Import that csv.

Step 2 - Determine which attributes are needed in the final report
- This is determined by running the cmdlet to display all available attributes
-- Example - get-mailbox cloud.user01 | fl
-- Example - get-mailboxstatistics managed01 | fl

Step 3 - Create a script to import the original or filtered csv and select the attributes needed in the script

Step 4 - Filter the csv to only show the results needed for the final report.
By running a simple filter on your spreadsheet, you can focus only on the data needed.

-------------------------------------------------------------------------------------------

Example 1 - Three filters
Create a mailbox report of VIPs and Shared mailboxes in the Singapore Office.

Step 1 - Create a csv filtered with shared and VIP mailboxes with Singapore in the 'Office' attribute
- To get all the information needed, this script requires us to capture CustomAttribute1 and the RecipientTypeDetails - while filtering only on mailboxes with the Singapore 'Office' attribute.

Script 1 -
Get-Mailbox -ResultSize "unlimited" -Filter {Office -eq "Singapore"} |
Select DisplayName,UserPrincipalName,Alias,CustomAttribute1,RecipientTypeDetails |
export-csv -NoTypeInformation c:\scripts\SingaporeMailboxes.csv

Exported csv -






-----

Step 2 - Filter the csv to only show - VIP user (and blank) in Custom Attribute1
This will now only show VIP and Shared Mailboxes with Singapore Office.
Open a new spreadsheet - copy the filtered data into the new spreadsheet.
Save the new csv as a different name - SingaporeVIPShared.csv





Step 3 - Create a script to import that csv and report on which mailboxes have forwarding enabled.
Script 2 -
Import-Csv -Path "C:\Scripts\SingaporeVIPShared.csv" |
foreach {Get-MailboxStatistics -id $_.UserPrincipalName} |
Select DisplayName,ItemCount,TotalItemSize,AttachmentTableTotalSize |
export-csv -NoTypeInformation c:\scripts\MailboxStats-SingaporeShared.csv

Exported csv - Final Report






-------------------------------------------------------------------------------------------

Example 2 - Create a report of Cloud mailboxes with Forwarders set

Step 1 - Create a csv filtered with Cloud Mailbox in CustomAttribute1

Script 1 -
Get-Mailbox -ResultSize "unlimited" -Filter {CustomAttribute1 -eq "Cloud Mailbox"} |
Select DisplayName,UserPrincipalName,Alias,CustomAttribute1 |
export-csv -NoTypeInformation c:\scripts\CloudMailboxes.csv

Exported csv -






-----

Step 2 - Create a script to import that csv and report on which mailboxes have forwarding enabled.

Script 2 -
Import-Csv -Path "C:\Scripts\CloudMailboxes.csv" |
foreach {Get-Mailbox -id $_.UserPrincipalName} |
Select Name, PrimarySMTPAddress, Alias, Displayname, DeliverToMailboxAndForward, ForwardingSmtpAddress |
export-csv -NoTypeInformation c:\scripts\ForwardedCloudMailboxes.csv

Exported csv -




Filter the spreadsheet - Use Excel Filters to only show results that have forwarding enabled.



-------------------------------------------------------------------------------------

Congratulations - 
You now have the knowledge of how to perform bulk management using multiple filters.

-------------------------------------------------------------------------------------

Basic PowerShell Tutorials
01. How to configure your desktop PC for Office 365 Administration - Link
02. How to connect to Office 365 via PowerShell - Link
03. How to create basic PowerShell scripts - Link
04. How to create basic PowerShell scripts with Export-CSV - Link
05. How to create basic PowerShell scripts with Import-CSV - Link

Series Tutorials -
How to manage Enterprise environments - Part 1 - Filtering queries - Link
How to manage Enterprise environments - Part 2 - Creating scripts with a filtered query - Link
How to manage Enterprise environments - Part 3 - Bulk management using multiple filters - Link

Tips and Tricks
General Tips and Tricks for better Office 365 Administration - Link
How to extend your Office 365 Trial - Link
How to get a 180 day trial tenant in Office 365 for testing - Link

-------------------------------------------------------------------------------------

No comments:

Post a Comment