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 [email protected] -user [email protected] -AccessRights FullAccess
 
//Don't add to Outlook
Add-MailboxPermission -Identity <Mailbox ID1> -User <Mailbox ID2>-AccessRights FullAccess -AutoMapping:$false
 
//Remove-MailboxPermission
Remove-MailboxPermission -identity [email protected] -user [email protected] -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
Connect-MSOLService
Get-MSOLUser | Set-MSOLUser -PasswordNeverExpires $true
 
//Remove Strong Password One User
Set-MsolUser -UserPrincipalName [email protected] -StrongPasswordRequired $False
 
//Remove for all Users
Get-MSOLUser | Set-MSOLUser -StrongPasswordRequired $False
 
 
// Forward to contact without Mailbox
New-MailContact John –ExternalEmailAddress [email protected]
$obj = Get-MailContact John
$obj.EmailAddresses.Add(“smtp:[email protected]“)
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 [email protected] -AccessRights SendAs -Trustee [email protected]
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...