Powershell Scripts
Please share your most commonly used Powershell Scripts here
Disable Clutter from all users
Get-Mailbox | Set-Clutter -Enable $false
Share all user calendars with one user
Get-Mailbox | ForEach-Object {$a=$_.identity; $a+”:\calendar”} | ForEach-Object {$a; Add-MailboxFolderPermission -Identity $a -User “username” -AccessRights PublishingAuthor}
Show list of users connecting with a mobile device
Get-MobileDevice | Select -Property DeviceType,DeviceUserAgent,Identity
Show the device ID of the mobile devices for requested user
Get-MobileDevice -mailbox %username% | Format-List Identity
Remote wipe a device
Clear-MobileDevice –Identity DEVICEID –NotificationEmailAddresses emailaddress@domain.com
for example:
Clear-MobileDevice –Identity "Bob Smith\ExchangeActiveSyncDevices\iPhone§GD4N05JLQ99VDR8NGKIN4VAI0C" –NotificationEmailAddresses emailaddress@domain.com
Remove a mobile device from list of devices
Remove-MobileDevice –Identity DEVICEID
for example:
Remove-MobileDevice –Identity "Bob Smith\ExchangeActiveSyncDevices\iPhone§GD4N05JLQ99VDR8NGKIN4VAI0C"
Display users who have forwarding enabled and show addresses
- Get-FowardingAddress.ps1
Get-Mailbox | Where {($_.ForwardingSMTPAddress -ne $null) -or ($_.ForwardingAddress -ne $null)} | Select Name, ForwardingSMTPAddress, ForwardingAddress, DeliverToMailboxAndForward
Display versions of Outlook connecting to Office 365
- Get-OutlookVersion.ps1
Get-Mailbox | Set-Mailbox -AuditOwner MailboxLogin -AuditEnabled $true Get-Mailbox | Search-MailboxAuditLog -LogonTypes owner -ShowDetails | ? { $_.ClientInfoString -like "*Outlook*" } | select MailboxOwnerUPN,Operation,LogonType,LastAccessed,ClientInfoString | export-csv .\OutlookConnections.csv