Uncle_Chunky
asked on
Getting the security descriptor of a folder on a remote machine
Hi,
I am trying to get the security descriptor of a folder on a remote machine with the following code:
************************** ********** *********
On Error Resume Next
strServerName = Server123
strWMIGenSharePath = E:\\Data\\Test
Set objWMI = GetObject("winmgmts:{imper sonationLe vel=impers onate}!\\" & strServerName & "\root\cimv2")
Set objShareSec = objWMI.Get("Win32_LogicalF ileSecurit ySetting.P ath=" & Chr(34) & strWMIGenSharePath & Chr(34))
Set retVal = objShareSec.GetSecurityDes criptor(ob jSD)
If Err <> 0 Then
WScript.Echo "GetSecurityDescriptor failed" _
& VBCRLF & Err.Number & VBCRLF & Err.Description
WScript.Quit
Else
WScript.Echo "GetSecurityDescriptor succeeded"
End If
************************** ********** *********
I get the following error:
GetSecurityDescriptor failed
424
Object required
So it seems that it is not finding the Win32_LogicalFileSecurityS etting class for the folder but if I echo out the properties they do seem valid:
objShareSec.caption "Security settings of E:\DATA\Test"
objShareSec.controlflags "32772"
objShareSec.description "Security settings of E:\DATA\Test"
objShareSec.ownerpermissio ns "-1"
objShareSec.path "E:\DATA\Test"
objShareSec.settingid "null"
Can anyone explain what is happening here please?
Thanks
I am trying to get the security descriptor of a folder on a remote machine with the following code:
**************************
On Error Resume Next
strServerName = Server123
strWMIGenSharePath = E:\\Data\\Test
Set objWMI = GetObject("winmgmts:{imper
Set objShareSec = objWMI.Get("Win32_LogicalF
Set retVal = objShareSec.GetSecurityDes
If Err <> 0 Then
WScript.Echo "GetSecurityDescriptor failed" _
& VBCRLF & Err.Number & VBCRLF & Err.Description
WScript.Quit
Else
WScript.Echo "GetSecurityDescriptor succeeded"
End If
**************************
I get the following error:
GetSecurityDescriptor failed
424
Object required
So it seems that it is not finding the Win32_LogicalFileSecurityS
objShareSec.caption "Security settings of E:\DATA\Test"
objShareSec.controlflags "32772"
objShareSec.description "Security settings of E:\DATA\Test"
objShareSec.ownerpermissio
objShareSec.path "E:\DATA\Test"
objShareSec.settingid "null"
Can anyone explain what is happening here please?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Thanks for the points! Happy new year!
ASKER
Open in new window