8,330 questions
Does your account have permission to remove the directory?
Try running the script using "Run as administrator". If that doesn't work, take ownership of the directory and try again (using run as administrator).
PowerShell is just reporting the problem, it's up to you, as the owner of the system, to assure that the necessary permission is assigned to the accounts that need a required access to resource.