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.

Answers


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.


Need Your Help

JavaScript iFrame to Parent postMessage issues

javascript iframe postmessage

I've been experiencing issues using postMessage in Firefox and Internet Explorer, whilst Google Chrome has worked sound as a pound each time.

jquery after 1minute send $POST to server

javascript settimeout

I know how to do a setTimeout(function(){}),xseconds}

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.