Troubleshooting Qualys: Test Connectivity Quickly with PowerShell
2 min readNov 30, 2024
Introduction
Ensuring that your system can connect to the Qualys Cloud Platform is critical for the smooth functioning of Qualys Agents. This article provides a quick and efficient one-liner PowerShell command to verify connectivity to the required Qualys endpoint.
The PowerShell Command
Use the following one-liner PowerShell commands to test connectivity to a Qualys endpoint:
You can replace URL based upon your Qualys SOC details.
Invoke-WebRequest -Uri "https://qualysguard.qg1.apps.qualys.co.uk/" -UseBasicParsing -TimeoutSec 10
Test-Connection -ComputerName "qualysguard.qg1.apps.qualys.co.uk" -Count 10
How It Works
Invoke-WebRequest
: Sends an HTTP request to the specified URL to check if the endpoint is reachable.-Uri
: The Qualys endpoint URL. Replace this with the appropriate URL for your region (e.g.,https://qualysapi.qg2.apps.qualys.com
).-UseBasicParsing
: Ensures the command works on all systems without relying on Internet Explorer components.-TimeoutSec 10
: Sets a timeout of 10 seconds to prevent the command from hanging indefinitely.
Steps to Use the Command
- Open PowerShell:
- Press
Win + R
, typepowershell
, and hit Enter. - Run the Command:
- Copy and paste the command into the PowerShell console and hit Enter.
- Analyze the Results:
- If the endpoint is reachable, you’ll receive an HTTP response with a status code like
200 OK
. - If there’s an issue, PowerShell will display an error message, such as “Unable to connect to the remote server.”
Example Outputs
Successful Connection
StatusCode : 200
StatusDescription : OK
Content : (HTML content of the endpoint)
RawContent : (Full raw response data)
Failed Connection
Invoke-WebRequest : Unable to connect to the remote server
When to Use This Command
- During Initial Setup: To confirm that the network allows communication to Qualys endpoints.
- Troubleshooting: When agents fail to communicate with the platform.
- Regular Checks: As part of periodic health checks for your Qualys deployment.