-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
130 changed files
with
34,418 additions
and
859 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.psd1 diff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,57 @@ | ||
#Requires -RunAsAdministrator | ||
|
||
# Run this script to enable basic authentication on your local desktop if you get an error when connecting to Exchange Online. | ||
# See README file Troubleshooting section for details. | ||
# | ||
# This script requires administrative privileges on your local desktop and updates a registry key. | ||
# | ||
$regPath = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client' | ||
$regKey = 'AllowBasic' | ||
<# | ||
.SYNOPSIS | ||
Set Registry to allow basic authentication for WinRM Client | ||
.DESCRIPTION | ||
Run this script to enable basic authentication on your local desktop if you get an error when connecting to Exchange Online. | ||
.NOTES | ||
See README file Troubleshooting section for details. | ||
This script requires administrative privileges on your local desktop and updates a registry key. | ||
#> | ||
|
||
function Test-RegistryKey { | ||
<# | ||
.SYNOPSIS | ||
Test if registry key exists | ||
#> | ||
param ( | ||
[parameter (Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()]$Path, | ||
[parameter (Mandatory = $true)] | ||
[ValidateNotNullOrEmpty()]$Key | ||
) | ||
|
||
if (Test-Path -LiteralPath $regPath){ | ||
try { | ||
$allowBasic = Get-ItemPropertyValue -Path $regPath -Name $regKey -ErrorAction Stop | ||
} | ||
catch [System.Management.Automation.PSArgumentException]{ | ||
Write-Error -Message "Key, $regKey, was not found" | ||
Get-ItemProperty -Path $Path -Name $Key -ErrorAction Stop | Out-Null | ||
return $true | ||
} | ||
catch{ | ||
Write-Error -Message "Unexpected error occured attempting to get registry key, $regKey." | ||
catch { | ||
return $false | ||
} | ||
} | ||
|
||
if ($allowBasic -ne '1'){ | ||
$regPath = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WinRM\Client' | ||
$regKey = 'AllowBasic' | ||
|
||
if (-Not $(Test-Path -LiteralPath $regPath)) { | ||
New-Item -Path $regPath -Force | Out-Null | ||
New-ItemProperty -Path $regPath -Name $regKey | Out-Null | ||
} elseif (-Not $(Test-RegistryKey -Path $regPath -Key $regKey)) { | ||
New-ItemProperty -Path $regPath -Name $regKey | Out-Null | ||
} | ||
|
||
try { | ||
$allowBasic = Get-ItemPropertyValue -Path $regPath -Name $regKey -ErrorAction Stop | ||
|
||
if ($allowBasic -ne '1') { | ||
Set-ItemProperty -Path $regPath -Name $regKey -Type DWord -Value '1' | ||
} | ||
} | ||
else { | ||
Write-Error -Message "Registry path not found: $regPath" | ||
catch { | ||
Write-Error -Message "Unexpected error occured attempting to update registry key, $regKey." | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#Requires -Version 5.1 | ||
<# | ||
.SYNOPSIS | ||
This script verifies the required Powershell modules used by the | ||
assessment tool are installed. | ||
.DESCRIPTION | ||
Verifies a supported version of the modules required to support SCuBAGear are installed. | ||
#> | ||
|
||
$RequiredModulesPath = Join-Path -Path $PSScriptRoot -ChildPath "RequiredVersions.ps1" | ||
if (Test-Path -Path $RequiredModulesPath){ | ||
. $RequiredModulesPath | ||
} | ||
|
||
if (!$ModuleList){ | ||
throw "Required modules list is required." | ||
} | ||
|
||
foreach ($Module in $ModuleList) { | ||
$InstalledModuleVersions = Get-Module -ListAvailable -Name $($Module.ModuleName) | ||
$FoundAcceptableVersion = $false | ||
|
||
foreach ($ModuleVersion in $InstalledModuleVersions){ | ||
|
||
if (($ModuleVersion.Version -ge $Module.ModuleVersion) -and ($ModuleVersion.Version -le $Module.MaximumVersion)){ | ||
$FoundAcceptableVersion = $true | ||
break; | ||
} | ||
} | ||
|
||
if (-not $FoundAcceptableVersion) { | ||
throw [System.IO.FileNotFoundException] "No acceptable installed version found for module: $($Module.ModuleName) | ||
Required Min Version: $($Module.ModuleVersion) | Max Version: $($Module.MaximumVersion) | ||
Run Get-InstalledModule to see a list of currently installed modules | ||
Run SetUp.ps1 or Install-Module $($Module.ModuleName) -force to install the latest version of $($Module.ModuleName)" | ||
} | ||
} | ||
|
||
|
||
|
||
|
33 changes: 33 additions & 0 deletions
33
PowerShell/ScubaGear/Modules/Connection/ConnectHelpers.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function Connect-EXOHelper { | ||
<# | ||
.Description | ||
This function is used for assisting in connecting to different M365 Environments for EXO. | ||
.Functionality | ||
Internal | ||
#> | ||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[ValidateSet("commercial", "gcc", "gcchigh", "dod", IgnoreCase = $false)] | ||
[string] | ||
$M365Environment | ||
) | ||
switch ($M365Environment) { | ||
{($_ -eq "commercial") -or ($_ -eq "gcc")} { | ||
Connect-ExchangeOnline -ShowBanner:$false -ErrorAction "Stop" | Out-Null | ||
} | ||
"gcchigh" { | ||
Connect-ExchangeOnline -ShowBanner:$false -ExchangeEnvironmentName "O365USGovGCCHigh" -ErrorAction "Stop" | Out-Null | ||
} | ||
"dod" { | ||
Connect-ExchangeOnline -ShowBanner:$false -ExchangeEnvironmentName "O365USGovDoD" -ErrorAction "Stop" | Out-Null | ||
} | ||
default { | ||
throw "Unsupported or invalid M365Environment argument" | ||
} | ||
} | ||
} | ||
|
||
Export-ModuleMember -Function @( | ||
'Connect-EXOHelper' | ||
) |
Oops, something went wrong.