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.
 
 
 
 
 
 

33 lines
943 B

'***************************************************************************
'This script tests associators methods on ISWbemServices and ISWbemObject
'***************************************************************************
On Error Resume Next
'Do it via a ISWbemServices
Set Service = GetObject("winmgmts:{impersonationLevel=impersonate}!root\cimv2")
Service.Security_.ImpersonationLevel = 3
if Err <> 0 Then
WScript.Echo Err.Description
Err.Clear
End if
Set Enumerator = Service.AssociatorsOf _
("Win32_DiskPartition.DeviceID=""Disk #0, Partition #1""", , "Win32_ComputerSystem",,,true)
for each Thingy in Enumerator
WScript.Echo Thingy.Path_.Relpath
next
'Do it via a ISWbemObject
Set Object = GetObject("winmgmts:Win32_DiskPartition")
for each Thingy in Object.Associators_ (,,,,,true)
WScript.Echo Thingy.Path_.Relpath
next
if Err <> 0 Then
WScript.Echo Err.Description
Err.Clear
End if