alex
November 22, 2016, 5:09pm
1
Hi,
I’m pulling my hair out with this one. I’m trying to run this command that works in the commandline:
ICACLS “C:\Program Files (x86)\Software AB” /INHERITANCE:e /GRANT:r “Domain\Domain Users”:(F) /T /C
But when I put it into the PS appdeployment toolkit script and run with with Execute-Process is does not work:
Execute-Process -Path “$envSystem32Directory\icacls.exe” -Parameters ““C:\Program Files (x86)\Software AB” /INHERITANCE:e /GRANT:r “Domain\Domain Users:(F)” /T /C”
I can’t wrap my head around all the spaces and the need for escape characters in the parameters section. I’m at a loss on how it works. Please help.
Hi,
I don’t know well ICACLS but why not using SECEDIT?
Thanks,
dan-6
November 23, 2016, 2:49pm
3
If you have quotes inside of other quotes. You have to use an escape character. Which in powershell is this. ’
So, try this.
Execute-Process -Path “$envSystem32Directory\icacls.exe’” -Parameters ‘“’”C:\Program Files (x86)\Software AB’” /INHERITANCE:e /GRANT:r “Domain\Domain Users:(F)’” /T /C”
alex
November 25, 2016, 12:34pm
4
Hi Dan,
Thank for helping with the commenting. I think the forum is formatting the escape character wrong.
Is it possible for you to post it somewhere else and link it?
dan-6
November 26, 2016, 10:24pm
5
Not really. I have been meaning to set up a website. I guess I need to work on that. Let me try and explain.
If you have " inside other quotes. Like this. " stuff " more stuff " stuff "
then the quotes inside need an escape character or they don’t come out right.
So, you need this key in front of the quotes on the inside. ’
" stuff '" more stuff '" stuff "
I hope that helps man.
Email me at dandanesia@gmail.com if that doesn’t help and I will tweak it and email it back to you.
dan-6
November 29, 2016, 3:35am
6
I made a mistake with my posts here. I am sorry. You need back ticks in front of the inside quotes.
The key in the upper left of the keyboard.
So, you need this.
Execute-Process -Path “$envSystem32Directory\icacls.exe” -Parameters “”C:\Program Files (x86)\Software AB
” /INHERITANCE:e /GRANT:r “Domain\Domain Users:(F)
” /T /C”
Basically a back tick in front of any inside quote.