Mail Box
Steps to RUN PowerShell Script
1) PowerShell Version
Please use below command to check PowerShell Version.
Get-Host | Select-Object Version
2) Update PowerShell Version
If PowerShell Version less than 5, Please install the following
Windows Management Framework 5.1
.NET Framework 4.5.2 (or newer)
Download link for the above software’s
.NET Framework 4.5.2 – https://www.microsoft.com/en-in/download/details.aspx?id=42642
Windows Management Framework 5.1- https://www.microsoft.com/en-us/download/details.aspx?id=54616
3) Restart Machine
Restart the machine and check the PowerShell version again with below command
Get-Host | Select-Object Version
4) Run the PowerShell script
Now script will run without any issues.
Powershell Script
set-executionpolicy unrestricted
Install-Module -Name ExchangeOnlineManagement
Import-Module ExchangeOnlineManagement
Connect-ExchangeOnline
Get-Mailbox -ResultSize Unlimited | Select-Object PrimarySmtpAddress, RecipientTypeDetails | Export-CSV UserTypeList1.csv
$env:PSModulePath=$env:PSModulePath+”;”+”C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell”
Install-Module -Name “AzureAD”
# Connect to AzureAD
Connect-AzureAD
# Get CSV content
$CSVrecords = Import-Csv C:\Windows\system32\UserTypeList1.csv
# Create arrays for skipped and failed users
$SkippedUsers = @()
$FailedUsers = @()
# Loop trough CSV records
foreach ($CSVrecord in $CSVrecords) {
$upn = $CSVrecord.PrimarySmtpAddress
$user = Get-AzureADUser -Filter “userPrincipalName eq ‘$upn’”
if ($user) {
try{
if($CSVrecord.RecipientTypeDetails -eq “SharedMailbox”) {
$user | Set-AzureADUser -Department ‘#SB’
}
} catch {
$FailedUsers += $upn
Write-Warning “$upn user found, but FAILED to update.”
}
}
else {
Write-Warning “$upn not found, skipped”
$SkippedUsers += $upn
}
}
# Array skipped users
# $SkippedUsers
# Array failed users
# $FailedUsers
Knowledge Base
User photos aren’t synced from the on-premises Active Directory to Employee Directory Plus after selecting Sync Outlook profile pictures.
User Photos Aren’t Synced From The On-Premises Active Directory To
Update Mobile Numbers in Employee Directory Plus Using Power Shell Script
Update Mobile Numbers In Employee Directory Plus Using Power Shell
Admin Guide – Employee Directory
Admin Guide – Employee Directory Knowledge Base Share on facebook
User Guide – Employee Directory
Employee Directory Plus Installation and User Manual Guide Once installation
How To Create Graph API With Permissions For Displaying Leaves In Outlook Calendar
How To Create Graph API With Permissions For Displaying Leaves