Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 lines
1.1 KiB

'***************************************************************************
'This script tests the setting of null property values and passing of
'null values to methods
'***************************************************************************
On Error Resume Next
Set Locator = CreateObject("WbemScripting.SWbemLocator")
'Note next call uses "null" for first argument
Set Service = Locator.ConnectServer (vbNullString, "root/default", null, null, null, , ,null)
Set aClass = Service.Get
'Set up a new class with an initialized property value
aClass.Path_.Class = "NULLPROPVALUETEST00"
aClass.Properties_.Add ("P", 3).Value = 25
aClass.Put_
if Err <> 0 Then
WScript.Echo Err.Description
Err.Clear
End if
'Now null the property value using non-dot access
Set aClass = Service.Get ("NULLPROPVALUETEST00")
Set Property = aClass.Properties_("P")
Property.Value = null
aClass.Put_
'Un-null
Set aClass = Service.Get ("NULLPROPVALUETEST00")
Set Property = aClass.Properties_("P")
Property.Value = 56
aClass.Put_
'Now null it using dot access
Set aClass = Service.Get("NULLPROPVALUETEST00")
aClass.P = null
aClass.Put_