Automox Script Overview: Start a Scan from a Device
Have you ever needed to run a scan from the client side?
There are times when you may want to trigger a scan from the device as part of an automation rather than from the console (or waiting for the next scheduled scan to run). For example, you want to automatically update the Automox inventory when a Windows 10 in-place upgrade successfully completes.
This script leverages the API to identify the local device, and then sends a secondary API call to schedule a scan for itself. Access this script in the original posting on the Automox community.
There are two areas in the code you’ll need to update to get the script to function:
- $orgID = ‘YOUR_ORG_ID’ - Put your Org ID, which can be found by looking at the URL of your Automox console and selecting the value after the “?o=”: for example, in the URL, https://console.automox.com/dashboard?o=999999, the Org ID would be 999999.
- $apiKey = ‘YOUR_API_KEY’ - In your Automox console, go to Settings > API and select the API key. Note that the API key is per admin user, so you and another admin in your console will have different API keys.
Once you’ve made those two changes, you can run the script on any Windows device using PowerShell.
If you wish to run the script in a test mode to verify the computer is being properly identified locally and through the API return, you can uncomment this line:
#echo "device: $serverName `t serverID: $ServerID `t hostname: $hostName"
and comment out the line that requests the scan for the device:
$getOSResponse = Invoke-WebRequest -UseBasicParsing -Method Post -Uri $getURI -Headers $headers -Body($body| ConvertTo-Json)
That will show you the device name, device ID, and the hostname as well as generate the json files to $logPath to help with troubleshooting.
Tips for Creating an Automox Worklet
Before deploying an Automox Worklet to the production environment, we suggest testing this on a few devices to confirm its accuracy. If you have any questions, please contact our support team for technical assistance at firstname.lastname@example.org.
For step-by-step instructions on creating the Worklet, see our user documentation: Create a Worklet.
About Automox Automated Patch Management
Facing growing threats and a rapidly expanding attack surface, understaffed and alert-fatigued organizations need more efficient ways to eliminate their exposure to vulnerabilities. Automox is a modern cyber hygiene platform that closes the aperture of attack by more than 80% with just half the effort of traditional solutions.
Cloud-native and globally available, Automox enforces OS & third-party patch management, security configurations, and custom scripting across Windows, Mac, and Linux from a single intuitive console. IT and SecOps can quickly gain control and share visibility of on-prem, remote and virtual endpoints without the need to deploy costly infrastructure.
Experience modern, cloud-native patch management today with a 15-day free trial of Automox and start recapturing more than half the time you're currently spending on managing your attack surface. Automox dramatically reduces corporate risk while raising operational efficiency to deliver best-in-class security outcomes, faster and with fewer resources.