Hello Gerry
How are you?
The product group has confirmed this product issue.
The sample codes are made for your references to work around it:
'CODE USING THE CREATE METHOD
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
'*************************************************************************
nAccessMask = 2032127
nAceFlags = 3
nAceType = 0
Dim objTrustee
Set objTrustee = objWMIService.Get("Win32_Trustee").SpawnInstance_()
objTrustee.Domain = ""
objTrustee.Name = "Everyone"
objTrustee.Properties_.Item("SID") = Array(1, 1, 0, 0, 0, 0, 0, 1, 0,
0, 0, 0)
Dim objAce
Set objAce = objWMIService.Get("Win32_Ace").SpawnInstance_()
objAce.Properties_.Item("AccessMask") = nAccessMask
objAce.Properties_.Item("AceFlags") = nAceFlags
objAce.Properties_.Item("AceType") = nAceType
objAce.Properties_.Item("Trustee") = objTrustee
Dim objSecDescriptor
Dim arrDACL
Set objSecDescriptor =
objWMIService.Get("Win32_SecurityDescriptor").SpawnInstance_()
objSecDescriptor.Properties_.Item("ControlFlags") = 4 + 1024 '**
SE_DACL_PRESENT | SE_DACL_AUTO_INHERITED
arrDACL = Array()
AddToArray arrDACL, objAce
objSecDescriptor.Properties_.Item("DACL") = arrDACL
Sub AddToArray(ByRef Arr, ByVal Val)
ReDim Preserve Arr (UBound(Arr)+1)
If (IsObject(Val)) Then
Set Arr(UBound(Arr)) = Val
Else
Arr(UBound(Arr)) = Val
End If
End Sub ' AddToArray
'*************************************************************************
' Obtain the definition of the class.
Set objShare = objWMIService.Get("Win32_Share")
' Obtain an InParameters object specific to the method.
Set objInParam = objShare.Methods_("Create").inParameters.SpawnInstance_()
' Add the input parameters.
objInParam.Properties_.Item("Description") = "testing"
'objInParam.Properties_.Item("Access") = objSecDescriptor
objInParam.Properties_.Item("Name") = "\\jialiang\share1"
objInParam.Properties_.Item("Path") = "d:\test"
objInParam.Properties_.Item("Type") = 0
' Execute the method and obtain the return status.
' The OutParameters object in objOutParams is created by the provider.
Set objOutParams = objWMIService.ExecMethod("Win32_Share", "Create",
objInParam)
' List OutParams
Wscript.Echo "Out Parameters: "
Wscript.echo "ReturnValue: " & objOutParams.ReturnValue
'CODE USING THE SetShareInfo Method
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
nAccessMask = 2032127
nAceFlags = 3
nAceType = 0
Dim objTrustee
Set objTrustee = objWMIService.Get("Win32_Trustee").SpawnInstance_()
objTrustee.Domain = ""
objTrustee.Name = "Everyone"
objTrustee.Properties_.Item("SID") = Array(1, 1, 0, 0, 0, 0, 0, 1, 0, 0,
0, 0)
Dim objAce
Set objAce = objWMIService.Get("Win32_Ace").SpawnInstance_()
objAce.Properties_.Item("AccessMask") = nAccessMask
objAce.Properties_.Item("AceFlags") = nAceFlags
objAce.Properties_.Item("AceType") = nAceType
objAce.Properties_.Item("Trustee") = objTrustee
Dim objSecDescriptor
Dim arrDACL
Set objSecDescriptor =
objWMIService.Get("Win32_SecurityDescriptor").SpawnInstance_()
objSecDescriptor.Properties_.Item("ControlFlags") = 4 + 1024 '**
SE_DACL_PRESENT | SE_DACL_AUTO_INHERITED
arrDACL = Array()
AddToArray arrDACL, objAce
objSecDescriptor.Properties_.Item("DACL") = arrDACL
Sub AddToArray(ByRef Arr, ByVal Val)
ReDim Preserve Arr (UBound(Arr)+1)
If (IsObject(Val)) Then
Set Arr(UBound(Arr)) = Val
Else
Arr(UBound(Arr)) = Val
End If
End Sub ' AddToArray
' Obtain an instance of the the class using a key property value.
Set objShare = objWMIService.Get("Win32_Share.Name='\\jialge\Share2'")
' Obtain an InParameters object specific to the method.
Set objInParam =
objShare.Methods_("SetShareInfo").inParameters.SpawnInstance_()
' Add the input parameters.
objInParam.Properties_.Item("Access") = objSecDescriptor
' Execute the method and obtain the return status.
' The OutParameters object in objOutParams is created by the provider.
Set objOutParams =
objWMIService.ExecMethod("Win32_Share.Name='\\jialge\Share2'",
"SetShareInfo", objInParam)
' List OutParams
Wscript.Echo "Out Parameters: "
Wscript.echo "ReturnValue: " & objOutParams.ReturnValue
Thanks for reporting this issue to us. If you have any other questions or
concerns, please feel free to tell us.
Regards,
Jialiang Ge (***@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
***@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================