PS script error

Hram Admin 140 Reputation points
2025-04-15T09:48:39.45+00:00

Hello!

I have a few scripts that delete old backups from some folders. There's actually one string that deletes the oldest folder:

Remove-Item -Path [Folder Name] -Recurse -Force

...and it works perfect for all folders except the one: while deleting this folder the script terminates with the error 0xC00000FC or - if run in ISE - the ISE itself exits and gets restarted.

This folder is different from any other only in containing user profiles, but the script is run with the #Requiers Administrator option so it must have the right to delete them.

Either script or ISE doesn't even delete anything - the folder size never changes, it seems the script just hangs for ~5-7 minutes and then crashes with 0xC00000FC.

What can be the cause of this?

Regards,
Michael

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,906 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 47,856 Reputation points
    2025-04-15T19:40:29.0333333+00:00

    It might be a damaged profile, or a profile with a very long name, or a profile with security that's unexpected. Or, it may be a damaged disk (perhaps a bad sector?).

    Sometimes just running with administrative privileges isn't sufficient (see unexpected security). Try running your script with backup and restore privileges.

    FYI, the Remove-Item will also remove (or try to) any sub-directories it encounters. Is that your intention?

    If you encounter a profile that's difficult to remove, you might want to try using delprof2 (https://helgeklein.com/free-tools/delprof2-user-profile-deletion-tool/).

    I don't think this is a PowerShell problem, though.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.