Here is a simple PowerShell script to remove users profiles from a windows machine.In this script, I have excluded some users from the removal process . Open an elevated Powershell command and execute the below script
Get-WMIObject -class Win32_UserProfile | Where {((!$_.Special) -and ($_.LocalPath -ne "C:\Users\spiderip") -and ($_.LocalPath -ne "C:\Users\spiderip1") -and ($_.LocalPath -ne "C:\Users\spider"))} | Remove-WMIObject
Comments