|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cannot retrieve Win32_SecurityDescriptor
with error: 'Not Found' Code: 80041002 Source:SWbemServicesEx on my Server 2003 standard edition with sp1. The same script functions correctly on my XP pro machine. The MSDN documentation for this WMI class indicates that it is available in Server 2003. Function CreateNetworkShare( svShareName, svSharePath, nSecurity) Const READ_ONLY = 1179817 Const MODIFY = 1245631 Const FULL_CONTROL = 2032127 Const DESCRIPTION = "Created by CreateNetworkShare" Const FILE_SHARE = 0 Const MAXIMUM_CONNECTIONS = "" Select Case nSecurity Case 1 nSecurity = READ_ONLY Case 2 nSecurity = MODIFY Case 3 nSecurity = FULL_CONTROL Case Else WScript.Echo "Invalid Parameter" WScript.Quit 1 End Select Set Services = GetObject("WINMGMTS:ROOT/CIMV2") Set SecDescClass = Services.Get("Win32_SecurityDescriptor") Set SecDesc = SecDescClass.SpawnInstance_() Set Trustee = Services.Get("Win32_Trustee").SpawnInstance_ Trustee.Domain = Null Trustee.Name = "EVERYONE" Trustee.Properties_.Item("SID") = Array(1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0) Set ACE = Services.Get("Win32_Ace").SpawnInstance_ ACE.Properties_.Item("AccessMask") = nSecurity ACE.Properties_.Item("AceFlags") = 3 ACE.Properties_.Item("AceType") = 0 ACE.Properties_.Item("Trustee") = Trustee SecDesc.Properties_.Item("DACL") = Array(ACE) Set Share = Services.Get("Win32_Share") Set InParam = Share.Methods_("Create").InParameters.SpawnInstance_() InParam.Properties_.Item("Access") = SecDesc InParam.Properties_.Item("Description") = DESCRIPTION InParam.Properties_.Item("Name") = svShareName InParam.Properties_.Item("Path") = svSharePath InParam.Properties_.Item("Type") = FILE_SHARE Set rtn = Share.ExecMethod_("Create", InParam ) End Function |
|||||||||||||||||||||||