Tag: PowerShell

PS: Add delegate to Room Mailbox for booking approval

PS: Add delegate to Room Mailbox for booking approval

Hi Guys

So today whilst at work I had another Powershell challenge to add delegates to our large number of meeting rooms in the exchange estate. See the below for the approach I had taken.

Get-Mailbox -ResultSize unlimited | where {$_.resourcetype -eq "Room"} | Set-Mailbox -GrantSendOnBehalfTo @{add="EndUser@User.com"}

I started out using the below example however this shown to be problematic as this over written the current configuration and does not append permissions.

Get-Mailbox -ResultSize unlimited | where {$_.resourcetype -eq "Room"} | Set-CalendarProcessing –ResourceDelegates "EndUser@User.com"
Advertisements
PS: Enable MFA For All Users O365

PS: Enable MFA For All Users O365

The below script will instruct your PowerShell session to connect to your Office365 environment and enable MFA across all enabled accounts within your estate

# Configuration of Powershell Session
Set-ExecutionPolicy Unrestricted –Scope CurrentUser
# Importation of Modules
Import-Module MSOnline
# User Input for O365 Creds
$UserCredential = Get-Credential
# Powershell Connection Standup with O365
Connect-MsolService –Credential $UserCredential
# Configuration of MFA Enviromental Varibles
$auth = New-Object -TypeName Microsoft.Online.Administration.StrongAuthenticationRequirement
$auth.RelyingParty = "*"
$auth.State = "Enabled"
$auth.RememberDevicesNotIssuedBefore = (Get-Date)
# Apply MFA to all users
Get-MsolUser -EnabledFilter EnabledOnly -All | Foreach{ Set-MsolUser -UserPrincipalName $_.UserPrincipalName -StrongAuthenticationRequirements $auth}
PS: User Mailbox SMTP Alias Address Report

PS: User Mailbox SMTP Alias Address Report

Hi Everyone,

Here is a quick and dirty script that will produce a table within your terminal session showing you each user mailbox along with any additional SMTP addresses that are associated to each of the mailbox’s

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
# Collect Data from exchange and store into varible
$box = Get-Mailbox | Where {$_.name -NotLike ‘*DiscoverySearchMailbox*’} | Where-Object -Property RecipientType -eq -Value UserMailbox | select primarysmtpaddress,name,@{Name=”EmailAddresses”;Expression={ ($_.EmailAddresses | Where-Object {$_ -cmatch “s mtp:*”} | ForEach-Object {$_ -replace 'smtp:' }) -join ',' }}
# Perform Count of records in varible
$count = $box | measure
# Count Output
Write-Host "Result Count: " -NoNewline -ForegroundColor Green $count.Count
# Result Table Output
$box | ft -autosize

 


Old Code

$UserCredential = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection Import-PSSession $Session Get-Mailbox | Where {$_.name -NotLike ‘*DiscoverySearchMailbox*’} | Where-Object -Property RecipientType -eq -Value UserMailbox | select primarysmtpaddress,name,@{Name=”EmailAddresses”;Expression={ ($_.EmailAddresses | Where-Object {$_ -cmatch “s mtp:*”} | ForEach-Object {$_ -replace ‘smtp:’ }) -join ‘,’ }} | ft -AutoSize