【发布时间】:2013-04-09 10:00:32
【问题描述】:
我有一个包含以下详细信息的文本文件,因此我需要有关可以将多个 SID 转换为可读用户名的脚本的帮助,但我真的对编码表示怀疑。
使用记事本打开时基于窗口的权限文件包含如下示例信息
[/]
S-1-5-21-1449722967-1661817991-10773629-12231=rw
S-1-5-21-1449722967-1661817991-10773629-15527=rw
[AM_ATTG:/]
S-1-5-21-1449722967-1661817991-10773629-1207=rw
在此期间,我找到了将 SID 从How can I use powershell to change sid in csv to user? 转换的脚本
因此,我将文件保存到 .csv 并将 第一列作为用户和 第二列作为权限
User Permission
[/]
S-1-5-21-1449722967-1661817991-10773629-12231 rw
S-1-5-21-1449722967-1661817991-10773629-15527 rw
[AM_ATTG:/]
S-1-5-21-1449722967-1661817991-10773629-1207 rw
但我在尝试第一个 powershell 脚本时收到以下错误,非常感谢您对我帖子的任何提示的回复。
Import-Csv : Cannot process argument because the value of argument "name" is invalid. Change the value of the "name" argument and run the operation again.
At line:1 char:19
+Import-Csv <<<< .\sid.csv | ForEach-Object{
+ CategoryInfo : InvalidArgument: (:) [Import-Csv], PSArgumentException
+ FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.ImportCsvCommand
【问题讨论】:
-
删除 .csv 文件中每个 SID 值的结尾“rw”。
标签: powershell vbscript