Delete 'User Profiles' using SCCM

  • Delete 'User Profiles' using SCCM

    Posted by Roddy Gelberty on 21 July 2020 at 1:17 pm

    How can I use SCCM to delete Windows 10 user profiles that have not been used in the last 60 days? We have a lot of kiosk devices used by 100’s of users. Month’s on we see a lot of local profiles on the device; a lot of them have not been used in over 60 days.

    Topaz George replied 3 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Topaz George

    Organizer
    21 July 2020 at 1:23 pm

    Use the below script to delete user profiles using PowerShell.

    Get-CimInstance win32_userprofile -verbose | Where {$_.LastUseTime -lt $(Get-Date).Date.AddDays(-60)} | Remove-CimInstance -Verbose

    You could deploy the above script using the following methods.

    • SCCM package.
    • SCCM Run Script.

    This is normally a one off activity so I prefer the ‘Run Script’ function. Hope this helps.

Log in to reply.

DCOM hardening issue.

This application fails to authenticate with WMI on the SCCM server because Microsoft has not yet hardened DCOM on their Windows Preinstallation Environment. We are working on a different approach, but it will only be released during the first quarter of 2024. But until that time, the only workaround will be to uninstall the update corresponding to KB5004442.