我想通过JS调用WMI 进行操作系统管理,然后有这么一段VBS代码,我想移植成JS的,不知如何移植
首先 下面这个函数的参数是OUT型
uint32 GetSecurityDescriptor(
[out] Win32_SecurityDescriptor Descriptor
);然后VBS的脚本代码如下
On Error Resume Next
' The folder named "testfolder" must exist on the C:\ drive.Set wmiFileSecSetting = GetObject( _
"winmgmts:Win32_LogicalFileSecuritySetting.path='c:\\testfolder'")RetVal = wmiFileSecSetting. _
GetSecurityDescriptor(wmiSecurityDescriptor)' Retrieve the DACL array of Win32_ACE objects.
DACL = wmiSecurityDescriptor.DACL我对红色代码进行如下移植
var SecDescriptor;
ReturnValue = LogSecObj.GetSecurityDescriptor( SecDescriptor );
DACL = SecDescriptor.DACL;
但是SecDescriptor再VC里调试时,SecDescriptor显示为undefined
所以DACL = SecDescriptor.DACL;也就无法操作。
请问如何用JS移植这段VBS的代码?多谢!(我个人觉得JS应该是有能力的,只不过我是JS新手)
首先 下面这个函数的参数是OUT型
uint32 GetSecurityDescriptor(
[out] Win32_SecurityDescriptor Descriptor
);然后VBS的脚本代码如下
On Error Resume Next
' The folder named "testfolder" must exist on the C:\ drive.Set wmiFileSecSetting = GetObject( _
"winmgmts:Win32_LogicalFileSecuritySetting.path='c:\\testfolder'")RetVal = wmiFileSecSetting. _
GetSecurityDescriptor(wmiSecurityDescriptor)' Retrieve the DACL array of Win32_ACE objects.
DACL = wmiSecurityDescriptor.DACL我对红色代码进行如下移植
var SecDescriptor;
ReturnValue = LogSecObj.GetSecurityDescriptor( SecDescriptor );
DACL = SecDescriptor.DACL;
但是SecDescriptor再VC里调试时,SecDescriptor显示为undefined
所以DACL = SecDescriptor.DACL;也就无法操作。
请问如何用JS移植这段VBS的代码?多谢!(我个人觉得JS应该是有能力的,只不过我是JS新手)
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货