This document outlines how to remove users from a computer using PowerShell.
Firstly, run PowerShell as an administrator and type the command:
Get-WMIObject -class Win32_UserProfile | Where {(!$.Special) -and ($.ConvertToDateTime($_.LastUseTime) -lt (Get-Date).AddDays(-180))} | Remove-WmiObject
This will remove the users that are over 180 days old. The parameter AddDays(-180) can be adjusted to any time length if you wish to delete users after a week just adjust the parameter to AddDays(-7).
Alternatively you can use the click method for manual removal of user accounts:
- Control Panel
- System
- Advanced System Settings
- Settings on User Profiles
- Select profile
- Press Delete
