Just a handy tip - you don't have to cast enum types in powershell usually. It will do that for you if that's the only constructor (or method) overload that makes sense:
$accessrule = New-Object system.security.AccessControl.FileSystemAccessRule $userName, ` "Modify", "ContainerInherit,ObjectInherit", "None", "Allow"
So when I say "only overload that makes sense," what do I mean by that? Take this method for example which has two overloads (meaning it has two different sets of parameters you could use):
void MyMethod(string a, string b, string c)
void MyMethod(string a, enum b, string c)
If you try to call that method with $o.MyMethod("foo", "foo", "foo"), it will pick the first version that takes three strings. In that case, you would have to cast/convert the enum to its native type so that powershell will pick the right method.
Page rendered at Friday, November 21, 2008 3:51:41 PM (Eastern Standard Time, UTC-05:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.