当我正在进行SID转换时,我发现在测试计算机上安装了VirsualSVN的可行脚本,但脚本无法在服务器上运行。我将文件保存为test.vbs放在桌面上并使用以下命令执行代码并将输出生成为文本文件: cscript test.vbs> C:\ output.txt的
在测试机器上,我安装了VisualSVN版本 2.5.8 ,根存储库位于C:\ Repositories
在服务器上,安装的VisualSVN版本 1.6.3 和根存储库位于E:\ Repositories
从下面的脚本中,我缺乏编码,不知道我应该在哪里修改脚本以使其在服务器上运行?我正在寻求你的专家帮助。
'
' Print permissions in the form: user_name,path,level
'
strComputer = "."
Set wmi = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\VisualSVN")
Set win = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
' Return text representation for the Access Level
Function AccessLevelToText(level)
If level = 0 Then
AccessLevelToText = "No Access"
ElseIf level = 1 Then
AccessLevelToText = "Read Only"
ElseIf level = 2 Then
AccessLevelToText = "Read/Write"
Else
AccessLevelToText = "Unknown"
End If
End Function
' Return repository path for the object
Function GetPath(obj)
cname = assoc.Path_.Class
If cname = "VisualSVN_Service" Then
GetPath = "Repositories Root"
ElseIf cname = "VisualSVN_Repository" Then
GetPath = assoc.Name
ElseIf cname = "VisualSVN_RepositoryEntry" Then
GetPath = assoc.RepositoryName & ": " & assoc.Path
Else
GetPath = "Unknown"
End If
End Function
' Convert SID to user name
Function SidToUserName(sid)
Set account = win.Get("Win32_SID.SID='" & sid & "'")
user = account.AccountName
domain = account.ReferencedDomainName
SidToUserName = domain & "\" & user
End Function
' Iterate over all security descriptions
Set objs = wmi.ExecQuery("SELECT * FROM VisualSVN_SecurityDescriptor")
For Each obj In objs
Set assoc = wmi.Get(obj.AssociatedObject)
For Each perm in obj.Permissions
sid = perm.Account.SID
level = AccessLevelToText(perm.AccessLevel)
Wscript.Echo SidToUserName(sid) & "," & GetPath(assoc) & "," & level
Next
Next
来自http://www.svnforum.org/threads/38790-Access-Rights-Reporting-in-Subversion-or-Viusal-SVN
的代码参考答案 0 :(得分:1)
0x8004100e
表示命名空间(/root/VisualSVN
)不存在。也许安装在服务器上的版本太旧,并且不会在WMI中创建此命名空间。
答案 1 :(得分:0)
按照@ Ansgar的回答。
无法通过WMI管理早于2.0的VisualSVN服务器版本。