Adding timestamps to scripts, Vagrantfile_prebuilt, logo

This commit is contained in:
Chris Long
2019-05-06 09:26:59 -07:00
parent 5a6c5408b0
commit 1261c0dfd8
31 changed files with 272 additions and 170 deletions

View File

@@ -28,7 +28,7 @@ public static class SSLValidator {
if (-not (Test-Path "C:\Program Files\Microsoft Advanced Threat Analytics\Center"))
{
$download = $false
if (-not (Test-Path "$env:temp\$title.iso"))
if (-not (Test-Path "$env:temp\$title.iso"))
{
Write-Host "$title.iso doesn't exist yet, downloading..."
$download = $true
@@ -40,13 +40,13 @@ if (-not (Test-Path "C:\Program Files\Microsoft Advanced Threat Analytics\Center
{
Write-Host "$title.iso exists, but has wrong hash, downloading..."
$download = $true
}
}
}
if ($download -eq $true)
{
Write-Host "Downloading $title..."
Invoke-WebRequest -Uri $downloadUrl -OutFile "$env:temp\$title.iso"
$actualHash = (Get-FileHash -Algorithm SHA256 -Path "$env:temp\$title.iso").Hash
$actualHash = (Get-FileHash -Algorithm SHA256 -Path "$env:temp\$title.iso").Hash
If (-not ($actualHash -eq $fileHash))
{
throw "$title.iso was not downloaded correctly: hash from downloaded file: $actualHash, should've been: $fileHash"
@@ -59,19 +59,19 @@ if (-not (Test-Path "C:\Program Files\Microsoft Advanced Threat Analytics\Center
$Install
$Mount | Dismount-DiskImage -Confirm:$false
$body = get-content "C:\vagrant\resources\microsoft_ata\microsoft-ata-config.json"
$req = [System.Net.WebRequest]::CreateHttp("https://wef")
try
try
{
$req.GetResponse()
}
catch
catch
{
# we don't care about errors here, we just want to get the cert ;)
}
$ThumbPrint = $req.ServicePoint.Certificate.GetCertHashString()
$body = $body -replace "{{THUMBPRINT}}", $ThumbPrint
Invoke-RestMethod -uri https://localhost/api/management/systemProfiles/center -body $body -Method Post -UseBasicParsing -UseDefaultCredentials -ContentType "application/json"
}
@@ -79,9 +79,9 @@ if (-not (Test-Path "C:\Program Files\Microsoft Advanced Threat Analytics\Center
Start-Sleep -Seconds 60
Invoke-Command -computername dc -Credential (new-object pscredential("windomain\vagrant",(ConvertTo-SecureString -AsPlainText -Force -String "vagrant"))) -ScriptBlock {
Write-Host "[$env:computername] Installing ATA Lightweight gateway..."
Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) [$env:computername] Installing ATA Lightweight gateway..."
# Enable web requests to endpoints with invalid SSL certs (like self-signed certs)
if (-not("SSLValidator" -as [type])) {
add-type -TypeDefinition @"
@@ -89,13 +89,13 @@ Invoke-Command -computername dc -Credential (new-object pscredential("windomain\
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public static class SSLValidator {
public static bool ReturnTrue(object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors) { return true; }
public static RemoteCertificateValidationCallback GetDelegate() {
return new RemoteCertificateValidationCallback(SSLValidator.ReturnTrue);
}
@@ -103,7 +103,7 @@ Invoke-Command -computername dc -Credential (new-object pscredential("windomain\
"@
}
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = [SSLValidator]::GetDelegate()
If (-not (Test-Path "$env:temp\gatewaysetup.zip"))
{
Invoke-WebRequest -uri https://wef/api/management/softwareUpdates/gateways/deploymentPackage -UseBasicParsing -OutFile "$env:temp\gatewaysetup.zip" -Credential (new-object pscredential("wef\vagrant",(convertto-securestring -AsPlainText -Force -String "vagrant")))
@@ -115,10 +115,10 @@ Invoke-Command -computername dc -Credential (new-object pscredential("windomain\
}
if (-not (Test-Path "C:\Program Files\Microsoft Advanced Threat Analytics"))
{
Set-Location "$env:temp\gatewaysetup"
Set-Location "$env:temp\gatewaysetup"
Start-Process -Wait -FilePath ".\Microsoft ATA Gateway Setup.exe" -ArgumentList "/q NetFrameworkCommandLineArguments=`"/q`" ConsoleAccountName=`"wef\vagrant`" ConsoleAccountPassword=`"vagrant`""
}
else
else
{
Write-Host "[$env:computername] ATA Gateway already installed. Moving On."
}
@@ -144,4 +144,4 @@ Invoke-RestMethod -Uri "https://localhost/api/management/systemProfiles/gateways
If ((Get-Service -name "ATACenter").Status -ne "Running")
{
throw "MS ATA service was not running."
}
}