Add permission Script No Longer Working

I have a script that would copy a folder, rename the new folder and then add the proper permissions to the new folder. This script worked flawlessly for a year then all of a sudden it stopped adding the permissions. I keep getting 

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : IdentityNotMappedException

I am including the script below, Any help will be greatly appreciated

$NewUser = Read-Host "Enter Name"

Copy-Item \\ComputerName\Profiles\Template \\ComputerName\Profiles\$NewUser -Recurse

$identity = "Domain\$NewUser"

$rights = 'FullControl' 

$inheritance = 'ContainerInherit, ObjectInherit'

$propagation = 'None'

$type = 'Allow'

$ACE = New-Object System.Security.AccessControl.FileSystemAccessRule($identity,$rights,$inheritance,$propagation,$type)

$ACL = Get-Acl -Path "\\ComputerName\Profiles\$NewUser"


0 Comments   [ + ] Show comments

Answers (2)

Posted by: barchetta 2 months ago
2nd Degree Black Belt

What happens if you run this manually in powershell on a device?

IE remove Kace from the equation.

Posted by: jbrower@sanmarcostx.gov 2 months ago
Senior White Belt

The solution, weirdly, was making the permission aspect a function. Once I did this it worked perfectly.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ