Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Cannot find an overload for "CommonSecurityDescriptor" and the argument count: "7"

$
0
0

Hey People,

I've got a short piece of PowerShell that I've converted from C#, but for whatever reason, it's not finding the 7 argument overload of CommonSecurityDescriptor when I call it.  I'm using PowerGUI to edit and it quite happily gives me intellisense for the 7 argument overload, but running the script just barfs.

Any ideas?

Thanks
Craig

$domainName = "DOMAIN"
$userName = "USERNAME"

$acc = New-Object Security.Principal.NTAccount($domainName, $userName)
$sid = $acc.Translate([Security.Principal.SecurityIdentifier])
$sd = New-Object Security.AccessControl.CommonSecurityDescriptor( $false, $false, [Security.AccessControl.ControlFlags].None, $sid, $null, $null, $null)

New-Object : Cannot find an overload for "CommonSecurityDescriptor" and the argument count: "7".
At C:\TEMP\SP ACLS\ACL_Test.ps1:6 char:7+ $sd = New-Object Security.AccessControl.CommonSecurityDescriptor( $false, $false ...+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~+ CategoryInfo          : InvalidOperation: (:) [New-Object], MethodException+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>