Skip to content
Open

Main #18

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions scripts/windows/InstallScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ $Token = "";
$Password = "";
$addRemove = 0; # default is 0

$originalProtocol = [System.Net.ServicePointManager]::SecurityProtocol
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::'SystemDefault'
# Set TLS 1.2 in a manner compatible with older .Net installations.
[Net.ServicePointManager]::SecurityProtocol = [Enum]::ToObject([Net.SecurityProtocolType], 3072)

# Determine whether or not the agent is already installed
$InstalledSoftware = Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
Expand All @@ -12,15 +12,15 @@ foreach($obj in $InstalledSoftware)
if ($obj.GetValue('DisplayName') -match "Archon")
{
Write-Host "Zorus Deployment Agent is already installed. Exiting."
Exit
Exit 0
}
}

if ([string]::IsNullOrEmpty($Token))
{
# Token must be set
Write-Host "Deployment token not provided. Exiting."
Exit
Exit 1
}

$source = "https://static.zorustech.com/downloads/ZorusInstaller.exe"
Expand All @@ -35,22 +35,22 @@ try
catch
{
Write-Host "Failed to download installer. Exiting."
Exit
Exit 1
}

if ([string]::IsNullOrEmpty($Password))
{
Write-Host "Installing Zorus Deployment Agent..."
Start-Process -FilePath $destination -ArgumentList "/qn", "ARCHON_TOKEN=$Token", "HIDE_ADD_REMOVE=$addRemove" -Wait
$Process = Start-Process -FilePath $destination -ArgumentList "/qn", "ARCHON_TOKEN=$Token", "HIDE_ADD_REMOVE=$addRemove" -Wait -NoNewWindow -PassThru
}
else
{
Write-Host "Installing Zorus Deployment Agent with password..."
Start-Process -FilePath $destination -ArgumentList "/qn", "ARCHON_TOKEN=$Token", "HIDE_ADD_REMOVE=$addRemove", "UNINSTALL_PASSWORD=$Password" -Wait
$Process = Start-Process -FilePath $destination -ArgumentList "/qn", "ARCHON_TOKEN=$Token", "HIDE_ADD_REMOVE=$addRemove", "UNINSTALL_PASSWORD=$Password" -Wait -NoNewWindow -PassThru
}

Write-Host "Removing temporary files..."
Remove-Item -recurse $destination
Write-Host "Installation complete."

[System.Net.ServicePointManager]::SecurityProtocol = $originalProtocol
Exit $Process.ExitCode
12 changes: 6 additions & 6 deletions scripts/windows/UninstallScript.ps1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$Password = ""

$originalProtocol = [System.Net.ServicePointManager]::SecurityProtocol
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::'SystemDefault'
# Set TLS 1.2 in a manner compatible with older .Net installations.
[Net.ServicePointManager]::SecurityProtocol = [Enum]::ToObject([Net.SecurityProtocolType], 3072)

$source = "https://static.zorustech.com/downloads/ZorusAgentRemovalTool.exe";
$destination = "$env:TEMP\ZorusAgentRemovalTool.exe";
Expand All @@ -15,22 +15,22 @@ try
catch
{
Write-Host "Failed to download removal tool. Exiting."
Exit
Exit 1
}

if ([string]::IsNullOrEmpty($Password))
{
Write-Host "Uninstalling Zorus Deployment Agent..."
Start-Process -FilePath $destination -ArgumentList "-s" -Wait
$Process = Start-Process -FilePath $destination -ArgumentList "-s" -Wait -NoNewWindow -PassThru
}
else
{
Write-Host "Uninstalling Zorus Deployment Agent with password..."
Start-Process -FilePath $destination -ArgumentList "-s", "-p $Password" -Wait
$Process = Start-Process -FilePath $destination -ArgumentList "-s", "-p $Password" -Wait -NoNewWindow -PassThru
}

Write-Host "Removing temporary files..."
Remove-Item -recurse $destination
Write-Host "Removal complete."

[System.Net.ServicePointManager]::SecurityProtocol = $originalProtocol
Exit $Process.ExitCode
10 changes: 5 additions & 5 deletions scripts/windows/UpdateScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# Please do NOT use this for fresh installs as it doesn't allow input for
# deployment tokens and other necessary first time install variables.

$originalProtocol = [System.Net.ServicePointManager]::SecurityProtocol
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::'SystemDefault'
# Set TLS 1.2 in a manner compatible with older .Net installations.
[Net.ServicePointManager]::SecurityProtocol = [Enum]::ToObject([Net.SecurityProtocolType], 3072)

$source = "https://static.zorustech.com/downloads/ZorusInstaller.exe"
$destination = "$env:TEMP\ZorusInstaller.exe"
Expand All @@ -17,14 +17,14 @@ try
catch
{
Write-Host "Failed to download update. Exiting."
Exit
Exit 1
}

Write-Host "Updating Zorus Deployment Agent..."
Start-Process -FilePath $destination -ArgumentList @('/qn ALLUSERS="1" AUTO_UPGRADE="1" /L*V "C:\Windows\Temp\ZorusInstaller.log"') -Wait
$Process = Start-Process -FilePath $destination -ArgumentList @('/qn ALLUSERS="1" AUTO_UPGRADE="1" /L*V "C:\Windows\Temp\ZorusInstaller.log"') -Wait -NoNewWindow -PassThru

Write-Host "Removing temporary files..."
Remove-Item -recurse $destination
Write-Host "Update complete."

[System.Net.ServicePointManager]::SecurityProtocol = $originalProtocol
Exit $Process.ExitCode