Powershell pass user input to icacls
Currently I am writing a powershell script to automate some security measures and I have run into a small problem.
icacls myDirectory /inheritance:r /grant:r 'Administrators:F' $myGroup + ':F'
will fail as $myGroup gets tacked onto the icacls
call and fails to properly add permissions to both groups. This is on Windows 7 and from the context of powershe开发者_运维知识库ll.
The parser sees $myGroup + ':F'
as three individual arguments. You can use either:
"${myGroup}:F"
or
($myGroup + ':F')
to provide this info to the parser as one argument.
精彩评论