-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathWindowsQCA.ps1
40 lines (38 loc) · 1.09 KB
/
WindowsQCA.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
param (
[string]$ActivationId,
[string]$CustomerId,
[string]$Downloadlocation = "c:\temp"
)
if (Get-Service \"QualysAgent\" -ErrorAction SilentlyContinue)
{
Write-Host \"Qualys Cloud Agent is already installed, Exiting\"
exit 0
}
if (!(Test-Path $Downloadlocation))
{
New-Item -ItemType Directory $Downloadlocation -ErrorAction SilentlyContinue | out-null
}
Set-Location -Path $Downloadlocation
$uri = "https://s3.amazonaws.com/qualys-agent-deploy/QualysCloudAgent.exe"
Write-Host -ForegroundColor White "==>Downloading from $uri"
try
{
$downloadlink = Invoke-WebRequest -Uri $uri -OutFile QualysCloudAgent.exe
$Downloadfile = Join-Path $Downloadlocation "QualysCloudAgent.exe"
}
catch
{
Write-Host $_.Exception|format-list -force
Write-Warning "Error While Downloading the file"
Break
}
try
{
& $Downloadfile CustomerId=$CustomerId ActivationId=$ActivationId
}
Catch
{
Write-Host \"Installation failed, exception raised during installation\"
Write-Host $_.Exception|format-list -force
exit 6
}