Skip to content

Instantly share code, notes, and snippets.

@HawaiiRyan
Created March 24, 2020 20:41
Show Gist options
  • Save HawaiiRyan/a04c2c09ed03114dbe2640d381a73e0a to your computer and use it in GitHub Desktop.
Save HawaiiRyan/a04c2c09ed03114dbe2640d381a73e0a to your computer and use it in GitHub Desktop.
example-MoreSecure
###Force commuincation to only occur with TLS 1.2
Write-Verbose -Message "Forcing TLS 1.2 Cipher...."
[Net.ServicePointManager]::SecurityProtocol =
[Net.SecurityProtocolType]::Tls12
Write-Verbose -Message "TLS 1.2 Ciper Successfully Enforced"
$filepath = Get-Location
$WS1Env = Get-Content -Path $filepath\tools\config.ini | Select -Skip 1 | ConvertFrom-StringData
$logPath = $WS1Env.logpath
Write-Verbose -Message "Verifying $logPath folder exists..."
If(!(test-path $logPath))
{
Write-verbose -Message "Creating $logPath..."
New-Item -ItemType Directory -Force -Path $logPath -EA Continue
}
Write-Verbose -Message "$logPath exists, proceeding to set variables"
$addy = $WS1Env.UATEnvironment
$b64 = $WS1Env.UATb64
$encodedString = "Basic " + $b64
$apiKey = $WS1Env.UATapikey
$useJSON = "application/json"
$headers = @{"Authorization" = $encodedString; "aw-tenant-code" = $apiKey; "Accept" = $useJSON; "Content-Type" = $useJSON}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment