Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
String cmdlet中的函数名_String_Function_Powershell_Cmdlet - Fatal编程技术网

String cmdlet中的函数名

String cmdlet中的函数名,string,function,powershell,cmdlet,String,Function,Powershell,Cmdlet,我尝试在set-acl cmdlet中使用我的函数,但它确实工作正常,我的函数被识别为一个简单的“字符串” 它被识别为字符串,因为您将其作为字符串编写。引号(“or”)中的所有内容都是字符串 如果函数返回字符串值,则可以如下使用: $acl = Get-Acl C:\MSI -Verbose $acl.SetAccessRuleProtection($True, $False) $rule = New-Object System.Security.AccessControl.FileSyste

我尝试在set-acl cmdlet中使用我的函数,但它确实工作正常,我的函数被识别为一个简单的“字符串”


它被识别为字符串,因为您将其作为字符串编写。引号(“or”)中的所有内容都是字符串

如果函数返回字符串值,则可以如下使用:

$acl = Get-Acl C:\MSI -Verbose
$acl.SetAccessRuleProtection($True, $False) 
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule ("Get-GroupName -SID 'S-1-1-0'","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow") -Verbose 
$acl.AddAccessRule($rule) 
$rule = New-ObjectSystem.Security.AccessControl.FileSystemAccessRule("Get-GroupName -SID 'S-1-5-32-544'","Readandexecute", "ContainerInherit, ObjectInherit", "None", "Allow") -Verbose 
$acl.AddAccessRule($rule) 
Set-Acl C:\MSI $acl
$acl = Get-Acl C:\MSI -Verbose
$acl.SetAccessRuleProtection($True, $False) 
$rule = New-Object System.Security.AccessControl.FileSystemAccessRule ((Get-GroupName -SID 'S-1-1-0'),"FullControl", "ContainerInherit, ObjectInherit", "None", "Allow") -Verbose 
$acl.AddAccessRule($rule) 
$rule = New-ObjectSystem.Security.AccessControl.FileSystemAccessRule((Get-GroupName -SID 'S-1-5-32-544'),"Readandexecute", "ContainerInherit, ObjectInherit", "None", "Allow") -Verbose 
$acl.AddAccessRule($rule) 
Set-Acl C:\MSI $acl