call icacls on powershell script


This followin command works in cmd line :

Invoke-Item "icacls.exe c:\test\ /T /C /grant "domain\user:(OI)(CI)F""

but in powershell cmd line :
The term 'OI' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
 of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:71
+ Invoke-Item "icacls.exe c:\test\ /T /C /grant "domain\user:((OI <<<< ))((CI))F""
    + CategoryInfo          : ObjectNotFound: (OI:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

How can I resolve this problem?


Who is Participating?
Can you try this in powershell?

icacls c:\test\ /T /C /grant 'domain\user:(OI)(CI)F'
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.