View all Worklets
Windows

Windows - Maintenance Tasks - Remove Old User Profiles

Deletes Windows user profiles surpassing a set age threshold.

Worklet Details

Introduction to the PowerShell-Based Remove Old User Profiles Worklet

The Remove Old User Profiles Worklet is a PowerShell script designed for Windows endpoints. This Worklet aims to streamline the process of identifying and removing user profiles that have exceeded a specified age limit. 

By automating this maintenance task, system administrators can efficiently manage user profiles on their devices, ensuring optimal performance and security.

Why would you use the Remove Old User Profiles Worklet?

Over time, old user profiles can accumulate on a device, taking up storage space and potentially causing performance issues. These outdated profiles may contain sensitive information that could be exploited by unauthorized users.

By utilizing the Remove Old User Profiles Worklet, administrators can automatically delete user profiles that are obsolete and safeguard important data. This reduces manual intervention and streamlines profile management across Windows endpoints.

Components of the Remove Old User Profiles Worklet

The evaluation code is responsible for checking the age of each user profile and determining if it should be removed based on the specified threshold. 

The remediation code then removes any user accounts flagged for deletion while also providing an overview of the impact on disk space.

How does the Remove Old User Profiles Worklet work?

This Worklet utilizes Get-CimInstance to retrieve local user profiles from the endpoints registry. It then calculates the time difference between each profile's LastUseTime attribute and the current date to determine its age in days. 

If a specific age limit has been set (ex. 30 days), any user profile older than this threshold will be marked for removal unless it belongs to certain whitelisted accounts, such as local administrator accounts or network service accounts.

What is the expected outcome when you use the Remove Old User Profiles Worklet?

Upon successful execution of the Remove Old User Profiles Worklet, this Worklet will identify and delete user profiles older than the specified number of days. This ensures that only active profiles are retained on a device, freeing up storage space and maintaining optimal system performance.

By utilizing this Worklet, administrators can save time and effort while consistently managing user profile data and local accounts across their network.

View in app

Consider Worklets your easy button

What's a Worklet?

A Worklet is an automation script, written in Bash or PowerShell, designed for seamless execution on endpoints – at scale – within the Automox platform. Worklet automation scripts perform configuration, remediation, and the installation or removal of applications and settings across Windows, macOS, and Linux.

do more with worklets