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 powershell.
The parser sees $myGroup + ':F' as three individual arguments. You can use either:
($myGroup + ':F')
to provide this info to the parser as one argument.