365 Useful Commands for Powershell Administration

Office-365-New[1]Add Permissions

$LiveCred = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection

Import-PSSession $Session

//Add to Outlook
UserA to B
Add-MailboxPermission -identity UserB@domain.com -user UserA@domain.com -AccessRights FullAccess
//Don't add to Outlook
Add-MailboxPermission -Identity <Mailbox ID1> -User <Mailbox ID2>-AccessRights FullAccess -AutoMapping:$false
Remove-MailboxPermission -identity ian@jeppesenheaton.co.uk -user geraldine@jeppesenheaton.co.uk -AccessRights FullAccess
//Viewmailbox Permission for Single Users 
Get-MailboxPermission –Identity “simon” | fl user, accessrights
//Export of All Permissions
Get-mailbox | Get-MailboxPermission | select-object FolderName,User,AccessRights,Identity, IsInherited,IsValid | export-csv -Path c:\teste.csv
//Add Distribution Group
Add-DistributionGroupMember -Identity Support -Member James -BypassSecurityGroupManagerCheck
//Password Never Expire
Get-MSOLUser | Set-MSOLUser -PasswordNeverExpires $true
//Remove Strong Password One User
Set-MsolUser -UserPrincipalName user1@abc.com -StrongPasswordRequired $False
//Remove for all Users
Get-MSOLUser | Set-MSOLUser -StrongPasswordRequired $False
// Forward to contact without Mailbox
New-MailContact John –ExternalEmailAddress Johnwang@forwardto.com
$obj = Get-MailContact John
Get-MailContact John | Set-MailContact -EmailAddresses $obj.EmailAddresses
Send as distribution List
Create Discribution List and add user to it
Set Account to Receive from outside 
Add-RecipientPermission newsletter@cogmotive.com -AccessRights SendAs -Trustee alan@cogmotive.com
GD Star Rating
GD Star Rating

Tags: 365, add permissions, commands, forward, office, Office 365, password expire, powershell, remove

Trackback from your site.