-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathM365SATTester.ps1
59 lines (52 loc) · 2.47 KB
/
M365SATTester.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
#Requires -Version 5.1
function ExecuteM365SAT
{
Import-Module .\M365SAT.psd1
<# MAKE CHANGES ONLY BELOW #>
#Get-M365SATReport -OutPath "C:\Out" -Username "[email protected]" -EnvironmentType AZURE,M365 -BenchmarkVersion "Latest" -Modules "All" -LicenseMode "All" -LicenseLevel "All" -reportType "HTML" -AllowLogging "Warning" -LocalMode -SkipChecks
# Get-M365SATReport -OutPath "C:\Out" -Username "[email protected]" -EnvironmentType M365 -BenchmarkVersion "Latest" -Modules "All" -LicenseMode "E3" -LicenseLevel "All" -reportType "HTML" -AllowLogging "Warning" -LocalMode -SkipChecks
Get-M365SATReport -OutPath "C:\Out" -Username "[email protected]" -EnvironmentType CUSTOM -BenchmarkVersion "Latest" -Modules Office365 -LicenseMode "E3" -LicenseLevel "All" -reportType "CSV" -AllowLogging "Warning" -LocalMode -SkipChecks -ExpirimentalMode
#Get-M365SATReport -OutPath "C:\Out" -Username "[email protected]" -EnvironmentType M365 -BenchmarkVersion "Latest" -Modules Exchange,Azure -LicenseMode "E3" -LicenseLevel "All" -reportType "HTML" -AllowLogging "Warning" -LocalMode -SkipChecks
<# END OF MAKING CHANGES #>
Remove-Module M365SAT -Force
}
#The script is being designed to work with PowerShell 5.1 where there is no automatic detection of the operating system. For PowerShell 7 $IsLinux $IsWindows can be used.
function CheckAdminPrivBeta
{
# Check if script is running as Adminstrator and if not use RunAs
if ($OS -eq 'Windows'){
Write-Host "[...] Checking if the script is running as Administrator"
$IsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
if (-not $IsAdmin)
{
Write-Warning "[!] Program needs Administrator Rights! Trying to Elevate to Admin..."
Start-Process powershell -Verb runas -ArgumentList "-NoExit -c cd '$pwd'; .\M365SATTester.ps1"
}
else
{
Write-Host "[+] The script is running as Administrator..." -ForegroundColor Green
ExecuteM365SAT
}
}elseif($OS -eq 'Linux'){
ExecuteM365SAT
}elseif($OS -eq 'MacOSX'){
ExecuteM365SAT
}
}
function Get-OperatingSystem{
param
(
[Parameter(Mandatory = $true,
HelpMessage = 'Operating System: Windows / Linux / MacOSX')]
[ValidateSet('Windows', 'Linux', 'MacOSX', IgnoreCase = $true)]
[string]$OS = 'Windows'
)
CheckAdminPrivBeta
}
if ($args[1] -eq $null){
Get-OperatingSystem
}
else
{
Get-OperatingSystem $args[1]
}