Skip to content

Commit 803985e

Browse files
authored
Merge pull request #608 from TheJumpCloud/revert-607-windows_install_script_fix
Revert "Update windows install script"
2 parents 1a13641 + 5cc75e8 commit 803985e

File tree

1 file changed

+25
-23
lines changed

1 file changed

+25
-23
lines changed

scripts/windows/InstallWindowsAgent.ps1

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,42 +10,44 @@ Param (
1010
#--- Modify Below This Line At Your Own Risk ------------------------------
1111

1212
# JumpCloud Agent Installation Variables
13+
$TempPath = 'C:\Windows\Temp\'
1314
$AGENT_PATH = Join-Path ${env:ProgramFiles} "JumpCloud"
1415
$AGENT_BINARY_NAME = "jumpcloud-agent.exe"
1516
$AGENT_INSTALLER_URL = "https://cdn02.jumpcloud.com/production/jcagent-msi-signed.msi"
1617
$AGENT_INSTALLER_PATH = "C:\windows\Temp\jcagent-msi-signed.msi"
1718
# JumpCloud Agent Installation Functions
1819
Function InstallAgent() {
19-
if (!(Test-Path "C:\ProgramData\JumpCloud\Agent")) {
20-
New-Item -ItemType Directory -Path "C:\ProgramData\JumpCloud\Agent" -Force
21-
}
22-
msiexec /i $AGENT_INSTALLER_PATH /quiet /norestart JCINSTALLERARGUMENTS=`"-k $JumpCloudConnectKey`" /L*V "C:\ProgramData\JumpCloud\Agent\jcUpdate.log"
20+
msiexec /i $AGENT_INSTALLER_PATH /quiet JCINSTALLERARGUMENTS=`"-k $JumpCloudConnectKey /VERYSILENT /NORESTART /NOCLOSEAPPLICATIONS /L*V "C:\Windows\Temp\jcUpdate.log"`"
2321
}
2422
Function DownloadAgentInstaller() {
2523
(New-Object System.Net.WebClient).DownloadFile("${AGENT_INSTALLER_URL}", "${AGENT_INSTALLER_PATH}")
2624
}
2725
Function DownloadAndInstallAgent() {
28-
Write-Output 'Downloading JCAgent Installer'
29-
# Download Installer
30-
DownloadAgentInstaller
31-
Write-Output 'JumpCloud Agent Download Complete'
32-
Write-Output 'Running JCAgent Installer'
33-
# Run Installer
34-
InstallAgent
35-
36-
# Check if agent is running as a service
37-
# Do a loop for 5 minutes to check if the agent is running as a service
38-
# The agent pulls cef files during install which may take longer then previously.
39-
for ($i = 0; $i -lt 300; $i++) {
40-
Start-Sleep -Seconds 1
41-
#Output the errors encountered
42-
$AgentService = Get-Service -Name "jumpcloud-agent" -ErrorAction SilentlyContinue
43-
if ($AgentService.Status -eq 'Running') {
44-
Write-Output 'JumpCloud Agent Succesfully Installed'
45-
exit
26+
If (Test-Path -Path "$($AGENT_PATH)\$($AGENT_BINARY_NAME)") {
27+
Write-Output 'JumpCloud Agent Already Installed'
28+
} else {
29+
Write-Output 'Downloading JCAgent Installer'
30+
# Download Installer
31+
DownloadAgentInstaller
32+
Write-Output 'JumpCloud Agent Download Complete'
33+
Write-Output 'Running JCAgent Installer'
34+
# Run Installer
35+
InstallAgent
36+
37+
# Check if agent is running as a service
38+
# Do a loop for 5 minutes to check if the agent is running as a service
39+
# The agent pulls cef files during install which may take longer then previously.
40+
for ($i = 0; $i -lt 300; $i++) {
41+
Start-Sleep -Seconds 1
42+
#Output the errors encountered
43+
$AgentService = Get-Service -Name "jumpcloud-agent" -ErrorAction SilentlyContinue
44+
if ($AgentService.Status -eq 'Running') {
45+
Write-Output 'JumpCloud Agent Succesfully Installed'
46+
exit
47+
}
4648
}
49+
Write-Output 'JumpCloud Agent Failed to Install'
4750
}
48-
Write-Output 'JumpCloud Agent Failed to Install'
4951
}
5052

5153
#Flush DNS Cache Before Install

0 commit comments

Comments
 (0)