Skip to content

Commit f86f3d1

Browse files
committed
Changed script name with approved verb
1 parent a7aa393 commit f86f3d1

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Get-DeviceIDs_ForTenant.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<#
2+
.Synopsis
3+
This script will loop through all users in the tenant and RETRIEVE the status of each user's device ID (allowed to sync / blocked from syncing).
4+
.DESCRIPTION
5+
This script will loop through all users in the tenant, RETRIEVE the device ID's allowed/blocked to sync from each individual, and create a report
6+
that will be located on the desktop. The script will also REMOVE ANY DUPLICATES with regards to the PrimarySmtpAddress property.
7+
.EXAMPLE
8+
.\Get-DeviceIDs_ForTenant.ps1
9+
#>
10+
11+
#Connect to O365
12+
$cred = Get-Credential
13+
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $cred -Authentication Basic -AllowRedirection
14+
Import-PSSession $Session
15+
16+
Write-Host "Connected to Exchange Online." -f Gray
17+
Write-Host "Now processing... Be patient." -f Yellow
18+
19+
#Declare Variable
20+
$Users = Get-CASMailbox
21+
$OutputFile = "C:\users\$env:USERNAME\Desktop\Report_DeviceIDsForTenant.csv"
22+
23+
$Results = @()
24+
foreach($user in $Users){
25+
$Results += Get-CASMailbox -Identity $user.UserPrincipalName | select PrimarySmtpAddress, @{n='AllowedDeviceIDs';e={$_.ActiveSyncAllowedDeviceIDs -join ";"}},@{n='BlockedDeviceIDs';e={$_.ActiveSyncBlockedDeviceIDs -join ";"}}
26+
}
27+
28+
$Results | Sort-Object -Unique -Property PrimarySmtpAddress | Export-Csv -Path $OutputFile -NoTypeInformation
29+
30+
Remove-PSSession $Session

0 commit comments

Comments
 (0)