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.

50 lines
1.4 KiB

  1. ' This script tests the ability to dynamically change privilege settings
  2. ' on Win2000, courtesy of cloaking.
  3. <job id="PrivilegeSetting">
  4. <object progid="WbemScripting.SWbemLocator" id="locator"/>
  5. <reference object="WbemScripting.SWbemLocator" version="1.1"/>
  6. <script language="VBScript">
  7. on error resume next
  8. locator.Security_.Privileges.Add wbemPrivilegeSecurity
  9. set service = locator.connectserver()
  10. PrintPrivileges
  11. GetDisks (service)
  12. service.Security_.Privileges.Add wbemPrivilegeIncreaseQuota
  13. service.Security_.Privileges.Remove wbemPrivilegeSecurity
  14. PrintPrivileges
  15. GetDisks (service)
  16. if err <> 0 then
  17. WScript.Echo Err.Number, Err.Description, Err.Source
  18. end if
  19. '****************************************************
  20. ' Display the privileges associated with this object
  21. '****************************************************
  22. public sub PrintPrivileges
  23. for each Privilege in service.Security_.Privileges
  24. Wscript.Echo ""
  25. WScript.Echo Privilege.DisplayName
  26. WScript.Echo Privilege.Identifier, Privilege.Name, Privilege.IsEnabled
  27. next
  28. end sub
  29. '****************************************************
  30. ' Enumerate the disks
  31. '****************************************************
  32. public sub GetDisks (service)
  33. set disks = service.instancesof ("Win32_logicaldisk")
  34. for each disk in disks
  35. WScript.Echo disk.Name
  36. next
  37. end sub
  38. </script>
  39. </job>