diff --git a/Segment/Cloud Connector (Agent)/install-CloudConnectorAPI.ps1 b/Segment/Cloud Connector (Agent)/install-CloudConnectorAPI.ps1 index 674c3e1..6168278 100644 --- a/Segment/Cloud Connector (Agent)/install-CloudConnectorAPI.ps1 +++ b/Segment/Cloud Connector (Agent)/install-CloudConnectorAPI.ps1 @@ -1,9 +1,9 @@ -#update3.1 +#update3.2 [CmdletBinding()] param( # API Token to get download URL [Parameter(Mandatory = $False)] - [String]$APIToken = "", + [String]$APIToken = " ", # Install/Uninstall [Parameter(Mandatory = $True)] @@ -12,12 +12,12 @@ param( # Token to use to install the Cloud Connector [Parameter(Mandatory = $False)] - [String]$CloudConnectorToken = "", + [String]$CloudConnectorToken = " ", # Cloud Connector Source [ValidateSet("AD", "WORKGROUP", "AZURE", "AZURE_AD", "AWS", "GCP", "IBM", "ORACLE", "VMWARE", "ALIBABA", "OVH", "LUMEN")] [Parameter(Mandatory = $False)] - [String]$CloudConnectorSource + [String]$CloudConnectorSource = "WORKGROUP" ) # Logging function @@ -33,15 +33,11 @@ function Write-Log { Write-Log -Message "Script execution started." # Validate API Token -if ($APIToken -eq "") { +if ($APIToken -eq "") { Write-Log -Message "API Token is required but not provided." -Level "ERROR" exit } -# Normalize function and source case -$CloudConnectorFunction = $CloudConnectorFunction.ToLower() -$CloudConnectorSource = $CloudConnectorSource.ToUpper() - # Define installer arguments switch ($CloudConnectorFunction) { "install" { @@ -114,6 +110,13 @@ try { exit } +#Tail setup log +$setupLogPath = "$env:LOCALAPPDATA\ZeroNetworks\logs\setup.log" +if (Test-Path -Path $setupLogPath) { + $setupText = Get-Content $setupLogPath -Tail 1 + Write-Log -Message $setupText +} + # Clean up temporary files try { Remove-Item -Path $zipPath -Force -ErrorAction SilentlyContinue @@ -144,4 +147,4 @@ if ($CloudConnectorFunction -eq "uninstall") { } } -Write-Log -Message "Script execution completed successfully." +Write-Log -Message "Script execution completed successfully." \ No newline at end of file