Converse agora com nosso suporte
Chat com o suporte

Power365 Current - Help Center

Help Center Home Power365 Platform Tenant-to-Tenant Directory Sync Migration for Active Directory Support

GET-ODBSUMMARY.PS1

# GET-ODBSUMMARY.PS1

# Binary Tree Inc

# Sept 2019

# Disclaimer: This example script is shared freely without warranty or support. It is only intended to provide guidance by example to project administrators.

# This script will connect to a session then collect all discovered users with OneDrive to provide a summary of the user totals and sizes.

# The larger the enviroment the more time this script will take to complete.

# Users must be discovered before running this assessment.

# Connect to production instance of Power365 by asking for their API Key

Write-Host

write-host 'To connect to Power365, enter the API key supplied to you to your Binary Tree representative: '

$apikey = Read-Host

# Verify Module is installed, if not install it

$VerifyInstall = Get-InstalledModule -Name BinaryTree.Power365 -ErrorAction silentlycontinue

If(!$VerifyInstall){

Write-host "Binary Tree Module was not found. It will be installed now. Please restart this script after installation."

Install-Module BinaryTree.Power365 -Confirm:$False -Force

Exit

}

Else

{

Connect-BTSession -ApiKey (ConvertTo-SecureString $apikey -AsPlainText -Force)

}

# Begin collecting ODB counts and size totals by different size categories

Cls

Write-Host

$ClientName = Get-BTSession | select -expand ClientName

write-host 'Building User OneDrive Size Assessment for' $ClientName

Write-Host

Write-Progress -Activity 'Collecting OneDrive Totals and Sizes' -Status "Please Stand-By... Large Environments may take several minutes to complete."

# ODB Unused *****************************************************

# GET COUNT

$NoODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -eq $null) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# 0 - 1 GB *****************************************************

# GET COUNT

$SmallestODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -ne $null) -and (ODBSize -lt 1073741824) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_SmallestODB = 0

$SmallestODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -ne $null) -and (ODBSize -lt 1073741824) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_Smallest in $SmallestODBSize){

$sum_SmallestODB += ($ODB_Smallest | Measure-Object -sum).sum

}

$SmallestODBSum = $sum_SmallestODB | Select-Object -Last 1

$display_SmallestODB = ([Math]::Round(($SmallestODBSum / 1.0GB),2))

# 1 - 10 GB *****************************************************

# GET COUNT

$SmallODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 1073741824) -and (ODBSize -lt 10737418240) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_SmallODB = 0

$SmallODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 1073741824) -and (ODBSize -lt 10737418240) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_Small in $SmallODBSize){

$sum_SmallODB += ($ODB_Small | Measure-Object -sum).sum

}

$smallodbsum = $sum_SmallODB | Select-Object -Last 1

$display_SmallODB = ([Math]::Round(($smallodbsum / 1.0TB),2))

# 10 - 25 GB *****************************************************

# GET COUNT

$MedODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 10737418240) -and (ODBSize -lt 26843545600) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_MedODB = 0

$MedODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 10737418240) -and (ODBSize -lt 26843545600) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_Med in $MedODBSize){

$sum_MedODB += ($ODB_Med | Measure-Object -sum).sum

}

$Medodbsum = $sum_MedODB | Select-Object -Last 1

$display_MedODB = ([Math]::Round(($Medodbsum / 1.0TB),2))

# 25 - 50 GB *****************************************************

# GET COUNT

$MedOverODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 26843545600) -and (ODBSize -lt 53687091200) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_MedOverODB = 0

$MedOverODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 26843545600) -and (ODBSize -lt 53687091200) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_MedOver in $MedOverODBSize){

$sum_MedOverODB += ($ODB_MedOver | Measure-Object -sum).sum

}

$MedOverodbsum = $sum_MedOverODB | Select-Object -Last 1

$display_MedOverODB = ([Math]::Round(($MedOverodbsum / 1.0TB),2))

# 50 - 100 GB *****************************************************

# GET COUNT

$LargeODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 53687091200) -and (ODBSize -lt 107374182400) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_LargeODB = 0

$LargeODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 53687091200) -and (ODBSize -lt 107374182400) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_Large in $LargeODBSize){

$sum_LargeODB += ($ODB_Large | Measure-Object -sum).sum

}

$Largeodbsum = $sum_LargeODB | Select-Object -Last 1

$display_LargeODB = ([Math]::Round(($Largeodbsum / 1.0TB),2))

# 100 - 500 GB *****************************************************

# GET COUNT

$LargerODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 107374182400) -and (ODBSize -lt 536870912000) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_LargerODB = 0

$LargerODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 107374182400) -and (ODBSize -lt 536870912000) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_Larger in $LargerODBSize){

$sum_LargerODB += ($ODB_Larger | Measure-Object -sum).sum

}

$Largerodbsum = $sum_LargerODB | Select-Object -Last 1

$display_LargerODB = ([Math]::Round(($Largerodbsum / 1.0TB),2))

# 500 - 700 GB *****************************************************

# GET COUNT

$LargestODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 536870912000) -and (ODBSize -lt 751619276800) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_LargestODB = 0

$LargestODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 536870912000) -and (ODBSize -lt 751619276800) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_Largest in $LargestODBSize){

$sum_LargestODB += ($ODB_Largest | Measure-Object -sum).sum

}

$Largestodbsum = $sum_LargestODB | Select-Object -Last 1

$display_LargestODB = ([Math]::Round(($Largestodbsum / 1.0TB),2))

# 700 - 1000 GB *****************************************************

# GET COUNT

$HUGEODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 751619276800) -and (ODBSize -lt 1099511627776) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_HUGEODB = 0

$HUGEODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 751619276800) -and (ODBSize -lt 1099511627776) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_HUGE in $HUGEODBSize){

$sum_HUGEODB += ($ODB_HUGE | Measure-Object -sum).sum

}

$HUGEodbsum = $sum_HUGEODB | Select-Object -Last 1

$display_HUGEODB = ([Math]::Round(($HUGEodbsum / 1.0TB),2))

# 1 - 2 TB *****************************************************

# GET COUNT

$HUMONGOUSODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 1099511627776) -and (ODBSize -lt 2199023255552) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_HUMONGOUSODB = 0

$HUMONGOUSODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 1099511627776) -and (ODBSize -lt 2199023255552) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_HUMONGOUS in $HUMONGOUSODBSize){

$sum_HUMONGOUSODB += ($ODB_HUMONGOUS | Measure-Object -sum).sum

}

$HUMONGOUSodbsum = $sum_HUMONGOUSODB | Select-Object -Last 1

$display_HUMONGOUSODB = ([Math]::Round(($HUMONGOUSodbsum / 1.0TB),2))

# 2 - + TB *****************************************************

# GET COUNT

$ridiculousODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 2199023255552) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_ridiculousODB = 0

$ridiculousODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 2199023255552) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_ridiculous in $ridiculousODBSize){

$sum_ridiculousODB += ($ODB_ridiculous | Measure-Object -sum).sum

}

$ridiculousodbsum = $sum_ridiculousODB | Select-Object -Last 1

$display_ridiculousODB = ([Math]::Round(($ridiculousodbsum / 1.0TB),2))

# Over Limit *****************************************************

# GET COUNT

# Users over the 25 Binary Tree License Pack Limit for a general user license

$OverPlanODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 26843545600) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# GET SUM

$sum_OverPlanODB = 0

$OverPlanODBSize = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -gt 26843545600) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB_OverPlan in $OverPlanODBSize){

$sum_OverPlanODB += ($ODB_OverPlan | Measure-Object -sum).sum

}

$OverPlanodbsum = $sum_OverPlanODB | Select-Object -Last 1

$display_OverPlanODB = ([Math]::Round(($OverPlanodbsum / 1.0TB),2))

# *****************************************************

# GET COUNT

# Total Users with ODB

$TotalODB = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -ne $null) -and (recipienttypedetails -eq "usermailbox")} | Measure-Object | select -expand count

# ODB Total Size

# GET SUM

$sum = 0

$TotalODBs = get-btuser -Filter {(OdbServicePlan -ne $null) -and (ODBSize -ne $null) -and (recipienttypedetails -eq "usermailbox")} | select -expand odbsize

foreach ($ODB in $TotalODBs){

$sum += ($ODB | Measure-Object -sum).sum

}

$sum | Select-Object -Last 1

$display_sum = ([Math]::Round(($sum / 1.0TB),2))

# Display Summary of Results *****************************************************

Cls

Write-Host

write-host $ClientName '- User OneDrive Size Assessment'

Write-Host

Write-Host "Total Mailbox Users with OneDrive Data:" $TotalODB -ForegroundColor Yellow

Write-Host

Write-Host "Total OneDrive Data:" $display_sum "TB" -ForegroundColor Yellow

Write-Host

Write-Host "Total Users that exceed 25 GB:" $OverPlanODB -ForegroundColor Yellow

Write-Host

Write-Host "Total OneDrive Data of the users that exceed the 25 GB:" $display_OverPlanODB "TB" -ForegroundColor Yellow

Write-Host

Write-Host "PLEASE NOTE:" $NoODB "users are licensed for OneDrive but have never been used and contain no data to report."-ForegroundColor DarkYellow

Write-Host

Write-Host "TOTAL COUNT BY SIZE" -ForegroundColor Gray

Write-Host " 0 - 1 GB:" $SmallestODB -ForegroundColor Green

Write-Host " 1 - 10 GB:" $SmallODB -ForegroundColor Green

Write-Host " 10 - 25 GB:" $MedODB -ForegroundColor Green

Write-Host " 25 - 50 GB:" $MedOverODB -ForegroundColor Red

Write-Host " 50 - 100 GB:" $LargeODB -ForegroundColor Red

Write-Host "100 - 500 GB:" $LargerODB -ForegroundColor Red

Write-Host "500 - 700 GB:" $LargestODB -ForegroundColor Red

Write-Host "700 - 1 TB:" $HUGEODB -ForegroundColor Red

Write-Host " 1 - 2 TB:" $HUMONGOUSODB -ForegroundColor Red

Write-Host " 2 - + TB:" $ridiculousODB -ForegroundColor Red

Write-Host "USERS TOTAL:" $TotalODB -ForegroundColor Cyan

Write-Host

Write-Host "TOTAL DATA BY SIZE" -ForegroundColor Gray

Write-Host " 0 - 1 GB:" $display_SmallestODB "GB" -ForegroundColor Green

Write-Host " 1 - 10 GB:" $display_SmallODB "TB" -ForegroundColor Green

Write-Host " 10 - 25 GB:" $display_MedODB "TB" -ForegroundColor Green

Write-Host " 25 - 50 GB:" $display_MedOverODB "TB" -ForegroundColor Red

Write-Host " 50 - 100 GB:" $display_LargeODB "TB" -ForegroundColor Red

Write-Host "100 - 500 GB:" $display_LargerODB "TB" -ForegroundColor Red

Write-Host "500 - 700 GB:" $display_LargestODB "TB" -ForegroundColor Red

Write-Host "700 - 1 TB:" $display_HUGEODB "TB" -ForegroundColor Red

Write-Host " 1 - 2 TB:" $display_HUMONGOUSODB "TB" -ForegroundColor Red

Write-Host " 2 - + TB:" $display_ridiculousODB "TB" -ForegroundColor Red

write-host "SIZE TOTAL:" $display_sum "TB" -ForegroundColor Cyan

Write-Host

Write-Host "PLEASE NOTE: All reported sizes are rounded and are not meant to be used to verify success. These sizes are only intended to provide an estimate on size for the purpose of planning." -ForegroundColor DarkYellow

Write-Host

# Confirm if they want to view and save to file one of the categories. This could be updated to use a different category you are more interested in. *****************************************************

$confirmation = Read-Host "Would you like to export and view the" $OverPlanODB "users that exceed the limit? (y or n)"

if ($confirmation -eq 'y') {

# proceed

$OverPlanODBoutput = get-btuser -Filter {(ODBSize -gt 26843545600) -and (recipienttypedetails -eq "usermailbox")} | Select-Object -property primarysmtpaddress,@{label = 'ODBSize(GB)';expression={[Math]::Round(($_.ODBSize / 1.0GB),2)}},@{label = 'mailboxsize(GB)';expression={[Math]::Round(($_.mailboxsize / 1GB),2)}} ,department,country,city,mailboxserviceplan,odbserviceplan,recipienttypedetails | Sort-Object -Property 'ODBSize(GB)' -Descending

$OverPlanODBoutput | Out-GridView -Title ($ClientName + " - User OneDrive Size Assessment - " +$OverPlanODB + " Users Exceed the 25 GB Limit")

$CSVPath = ".\OneDrive_Size_Assessment.csv"

$OverPlanODBoutput | Export-Csv -Path $CSVPath -NoTypeInformation

}

Documentos relacionados

The document was helpful.

Selecione a classificação

I easily found the information I needed.

Selecione a classificação