Wonder if it is possible to just specify a command to delete a specific cached profile regardless of the duration? These scripts and another one i found work OK, however always files are left on the machine. Usually in appdata and they are microsoft applications. It also sucks at deleting cached one drive files i think becuase of permissions.
I also found this similar code while i have been searching for solutions. Hi there, I'm currently testing this script with a few machines. So far it's working very well. This is just what we needed.
Thank you for posting. Delete User Profiles With Powershell. Verify your account to enable IT peers to see that you are a professional. Nov 10, 1 Minute Read. Reply Facebook Twitter Reddit LinkedIn.
Charlie Smith This person is a verified professional. Main Areas of Contribution:. I would like have a Script that would only delete old No of Months profile as well as the registry itself but should keep the current profile instanct the the registry too. I did find the script on some forum that gets the job done but not the right way as it deletes all the profile and excludes the admin,administrator etc in the script but i cannot delete the old profile of a certain time or date period.
If your workstations are domain joined and you have access to modify group policies then all of this can be specified in GPO;. It's a command line tool so you can script it and takes a parameter to specify how old a profile must be before it's eligible for deletion.
For example this command will delete all local profiles older than 60 days;. All other organizations may use Delprof2 for free, too, if they allow us to publish their name.
Otherwise a commercial license must be purchased. Seeing as you appear to want an additional option, try this script or a modification of it. You'll probably want to remove the MsgBox line, and the unused period can be adjusted by changing the value of variable 'intMaxProfileAge'. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Learn more. Script to delete users profile only months old profile with the Registry itself but should leave current profile intact Ask Question. Asked 7 years, 3 months ago. Active 7 years, 3 months ago. Viewed 6k times. If you have a correct link please post it below or the script itself. As again sorry if this post looks like mess but help is appreciated. By using the ComputerName parameter, you can specify, 1, 10 or different remote computers and it will happily query each one.
Once you understand how to enumerate user profiles on computers, you can take it one step further and delete those user profiles as well. This is the same as going into the User Profiles box under System settings and hitting the Delete button.
To do this, enumerate the user profiles again and this time apply a filter to pick a single user profile to remove. In this case, remove the user profile called UserA. This process will remove the user profile from the file system and the registry. Use CIM the next time you need to query or delete user profiles from Windows computers in your environment.
0コメント