Otto  background

Automox Script: Move Devices Disconnected Longer than X Days to a Group

Connect With Us

Start now, and patch, configure, and control all your endpoints in just 15 minutes.

Does this scenario sound familiar? You want to audit your devices to determine which ones haven’t connected for a certain amount of time. You’re not prepared to remove these devices from Automox, but you’d like to move them to their own group. You can do this from the Automox Devices page in the console by sorting by Last Disconnected Date and selecting these devices to assign to a group. However, if you have a large number of disconnected devices this view can become unwieldy and expand across multiple page views.

As an alternative, you can use a Powershell script to automate the move using an API call that checks the last disconnected date and moves any device older than the number of days you specify in the code. We provide the sample script here on the Automox Alive Community, and provide detailed notes on how to update it for your environment.

There are five areas in the code you’ll need to update to get the script to function:

  1. $orgID = 'YOUR_ORG_ID'
  2. $apiKey = 'YOUR_API_KEY'
  3. $srvGroup = 'GROUP_ID#_TO_MOVE_TO'
  4. $maxDays = 120
  5. $logPath = 'C:\temp\'

By default, the script will move all Windows devices older than $maxDays. But, if you prefer to only move Windows 7/8/10 workstations, there’s an alternate IF statement you can use on line 61 of the script.

Once you’ve made those changes, you can run the script on any Windows device using Powershell. If you have any questions, please contact our support team for technical assistance at support@automox.com.


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 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.