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.

19 lines
714 B

  1. on error resume next
  2. ' Step 1 - this should work if default impersonation level set correctly
  3. set disk = GetObject("winmgmts:Win32_LogicalDisk=""C:""")
  4. WScript.Echo "Free space is: " & Disk.FreeSpace
  5. ' Step 2 - should now be able to quiz locator for default imp
  6. Set Locator = CreateObject ("WbemScripting.SWbemLocator")
  7. WScript.Echo "Impersonation level is: " & Locator.Security_.impersonationLevel
  8. ' Step 3 - should be able to connect to cimv2 from locator
  9. Set Services = Locator.ConnectServer()
  10. set disk2 = Services.Get ("Win32_LogicalDisk=""D:""")
  11. WScript.Echo "Free space is: " & Disk2.FreeSpace
  12. if err <> 0 then
  13. WScript.Echo "0x" & Hex(Err.Number), Err.Description, Err.Source
  14. end if