-
Notifications
You must be signed in to change notification settings - Fork 0
/
OfficePowershellReference.txt
57 lines (39 loc) · 2.63 KB
/
OfficePowershellReference.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
Connect-MsolService
Get-MsolUser -ReturnDeletedUsers
Remove-MsolUser -UserPrincipalName [email protected] -RemoveFromRecycleBin
$orgName="ascendsoftware.com"
$credential = Get-Credential
Connect-MsolService -Credential $credential
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking
Connect-SPOService -Url https://$orgName-admin.sharepoint.com -credential $credential
Import-Module SkypeOnlineConnector
$sfboSession = New-CsOnlineSession -Credential $credential
Import-PSSession $sfboSession
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -DisableNameChecking
$SccSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid/ -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $SccSession -Prefix cc
EXCHANGE ONLINE
$credential = Get-Credential
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession -DisableNameChecking
Get Calendar Permission
Get-MailboxFolderPermission -Identity "[email protected]:\Calendar\This Calendar\"
Give calendar permission to someone else
Set-MailboxFolderPermission -Identtity "[email protected]:\Calendar\This Calendar\ -user [email protected] -accessrights Editor
REGULAR DISTRIBUTION COMMAND
Get-DistributionGroupMember
Remove-DistributionGroupMember -Identity -Member
OFFICE365 GROUP COMMAND
Remove-UnifiedGroupLinks -Identity KBA -Links [email protected] -LinkType Members
Remove-UnifiedGroupLinks -Identity KBA -Links [email protected] -LinkType Members
Remove-UnifiedGroupLinks -Identity "Quality Assurance / Testing" -Links [email protected] -LinkType Members
Remove-UnifiedGroupLinks -Identity "Scrum" -Links [email protected] -LinkType Members
Remove-UnifiedGroupLinks -Identity "Technical Team" -Links [email protected] -LinkType Members
Remove-UnifiedGroupLinks -Identity "The Sonar" -Links [email protected] -LinkType Members
Get all mailboxes with forwarding
Get-Mailbox | Where {$_.ForwardingAddress -ne $null} | Select Name, UserPrincipalName, ForwardingAddress, DeliverToMailboxAndForward
Set forwarding
Set-Mailbox -Identify "Username" -delivertomailboxandforward $true -forwardingaddress "Username"
Get forwarding on mailboxes
Get-Mailbox -Identity "username" | select {$_.forwardingaddress}