Powershell 意外标记';服务器';在表达或陈述中 $ServerList=Get Content“C:\Users\munjanga\Desktop\Execute\Testing\servers.txt” $ServerList $Header=“FolderPath,IdentityReference,AccessControlType,IsInherited,InheritedFlags,PropagationFlags” 添加内容-值$Header-路径$Output Foreach($ServerList中的服务器){ $output=“\\C:\Users\munjanga\Desktop\repositoy”$server.output.csv Del$输出-错误操作SilentlyContinue $RootPath=“\\$Server\C:\system.sav” $Folders=dir$RootPath-recurse |其中{$\ psiscontainer-eq$true}-ErrorAction SilentlyContinue 添加内容-值“$Header”-路径$Output Foreach($文件夹中的文件夹){ $ACLs=get-acl$Folder.fullname | ForEach对象{$\.Access} Foreach($ACL中的ACL){ $OutInfo=$Folder.Fullname+”、“+$ACL.IdentityReference+”、“+$ACL.AccessControlType+”、“+$ACL.IsInherited+”、“+$ACL.InheritanceFlags+”、“+$ACL.PropagationFlags+” 添加内容-值$OutInfo-路径$output-ErrorAction SilentlyContinue } } }

Powershell 意外标记';服务器';在表达或陈述中 $ServerList=Get Content“C:\Users\munjanga\Desktop\Execute\Testing\servers.txt” $ServerList $Header=“FolderPath,IdentityReference,AccessControlType,IsInherited,InheritedFlags,PropagationFlags” 添加内容-值$Header-路径$Output Foreach($ServerList中的服务器){ $output=“\\C:\Users\munjanga\Desktop\repositoy”$server.output.csv Del$输出-错误操作SilentlyContinue $RootPath=“\\$Server\C:\system.sav” $Folders=dir$RootPath-recurse |其中{$\ psiscontainer-eq$true}-ErrorAction SilentlyContinue 添加内容-值“$Header”-路径$Output Foreach($文件夹中的文件夹){ $ACLs=get-acl$Folder.fullname | ForEach对象{$\.Access} Foreach($ACL中的ACL){ $OutInfo=$Folder.Fullname+”、“+$ACL.IdentityReference+”、“+$ACL.AccessControlType+”、“+$ACL.IsInherited+”、“+$ACL.InheritanceFlags+”、“+$ACL.PropagationFlags+” 添加内容-值$OutInfo-路径$output-ErrorAction SilentlyContinue } } },powershell,syntax-error,Powershell,Syntax Error,这一行的字符串文字格式不正确: $output=“\\C:\Users\munjanga\Desktop\repositoy”$server.output.csv” --^ 上面指出的“不应该在那里。我想你是想写: $output=“\\C:\Users\munjanga\Desktop\Repositroy\$server.output.csv” 字符串开头的双正斜杠也可能不正确。也许应该删除它: $output=“C:\Users\munjanga\Desktop\Repositroy

这一行的字符串文字格式不正确:

$output=“\\C:\Users\munjanga\Desktop\repositoy”$server.output.csv”
--^
上面指出的
不应该在那里。我想你是想写:

$output=“\\C:\Users\munjanga\Desktop\Repositroy\$server.output.csv”

字符串开头的双正斜杠也可能不正确。也许应该删除它:

$output=“C:\Users\munjanga\Desktop\Repositroy\$server.output.csv”

感谢您帮助我克服了这一困难,但现在我得到了:“cmdlet where对象位于命令管道位置1。为以下参数提供值:Filterscript:“它不像请求那样显示为错误,因此我想知道它是否要求输入实际的服务器?我正在虚拟机中运行测试,因此我不知道这是否可能导致此问题,因为从技术上讲,我只有一个“服务器”,有人可以提供建议吗?