-
Notifications
You must be signed in to change notification settings - Fork 0
/
Product_Examples_Office365.ps1
118 lines (92 loc) · 4.28 KB
/
Product_Examples_Office365.ps1
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
##################Exchange Modern Online##################
Function LaunchEOL {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
$Credential
)
Import-Module ExchangeOnlineManagement -Prefix "EOL"
Connect-ExchangeOnline -Prefix "EOL" -Credential $Credential -ShowBanner:$false
}
Function RemoveEOL {
Disconnect-ExchangeOnline -Confirm:$false
}
############Sharepoint Online###############################
function LaunchSPO
{
param
(
[Parameter(Mandatory = $true)]
$orgName,
[Parameter(Mandatory = $false)]
$Credential
)
Write-Host "Enter Sharepoint Online Credentials" -ForegroundColor Green
Connect-SPOService -Url "https://$orgName-admin.sharepoint.com" -Credential $Credential
} #LaunchSPO
Function RemoveSPO
{
disconnect-sposervice
} #RemoveSPO
####Secuirty and Compliance#####################################
Function LaunchCOL {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
$Credential
)
Import-Module ExchangeOnlineManagement
Connect-IPPSSession -Credential $Credential
$s=Get-PSSession | where {$_.ComputerName -like "*compliance.protection.outlook.com"}
Import-Module (Import-PSSession -Session $s -AllowClobber) -Prefix col -Global
}
Function RemoveCOL {
Disconnect-ExchangeOnline -Confirm:$false
}
###############################Msonline#########################
function LaunchMSOL {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $false)]
$Credential
)
import-module msonline
Write-Host "Enter MS Online Credentials" -ForegroundColor Green
Connect-MsolService -Credential $Credential
}
Function RemoveMSOL {
Write-host "Close Powershell Window - No disconnect available" -ForegroundColor yellow
}
###################################################################
#Exchange Online Mailbox Report
Get-EOLMailbox -ResultSize unlimited | Select Name,RecipientTypeDetails,PrimarySMTPAddress,UserPrincipalName,litigationholdenabled,LitigationHoldDuration,
PersistedCapabilities,RetentionHoldEnabled,RetentionPolicy,RetainDeletedItemsFor,ArchiveName,Archivestatus,ProhibitSendQuota,ProhibitSendReceiveQuota,
MaxSendSize,MaxReceiveSize,AuditEnabled | export-csv c:\auditmbx.csv -notypeinfo
#########################large teanant more than 50000############################
$allmbx=Invoke-Command -Session (Get-PSSession | Where-Object{$_.computerName -eq "outlook.office365.com"}) -scriptblock {Get-Mailbox -ResultSize unlimited |
Select-object Name,RecipientTypeDetails, PrimarySMTPaddress,UserPrincipalname,AuditEnabled,litigationholdenabled,LitigationHoldDuration,PersistedCapabilities,
RetentionHoldEnabled,RetentionPolicy,RetainDeletedItemsFor,ArchiveName,Archivestatus,ArchiveGuid,ProhibitSendQuota,ProhibitSendReceiveQuota,MaxSendSize,MaxReceiveSize,
WhenMailboxCreated,WhenCreated,HiddenFromAddressListsEnabled }
$allmbx | export-csv c:\data\auditmbx.csv -notypeinfo
###################################################################
#Exchange Online Message Tracking
$index = 1
while ($index -le 1001)
{
Get-EOLMessageTrace -SenderAddress "VikasS@techWizard.cloud" -StartDate 09/20/2019 -EndDate 09/25/2019 -PageSize 5000 -Page $index | export-csv c:\messagetracking.csv -Append
$index ++
sleep 5
}
###################################################################
#Searching Unified Log
Search-EOLUnifiedAuditLog -StartDate 1/8/2019 -EndDate 4/7/2019 -RecordType MicrosoftTeams -UserIds VikasS@sycloudpro.com -ResultSize:5000 |export-csv c:\VikasS.csv -notypeinfo
###################################################################
#extracting Exchange mailbox audit activity
Search-EOLUnifiedAuditLog -StartDate 10/24/2019 -EndDate 10/25/2019 -UserIds VikasS@syscloudpro.com -recordtype "ExchangeItemGroup","ExchangeItem","ExchangeAggregatedOperation" -ResultSize:5000 |export-csv c:\VikasS.csv -notypeinfo
###################################################################
#Adding or Removing Role member audit
Search-EOLUnifiedAuditLog -StartDate 4/16/2019 -EndDate 7/15/2019 -UserIds VikasS@syscloudpro.com -operations "Add role member to role" -ResultSize:5000 |export-csv c:\VikasS.csv -notypeinfo
####################################################################