Source code of Windows XP (NT5)
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.

70 lines
1.4 KiB

  1. '
  2. ' Test IConfigureYourServer::DsRole
  3. '
  4. option explicit
  5. // this is a Visual Basic Script "Template", used in conjunction with the
  6. // MS Visual C++ Preprocessor to overcome some of the source management
  7. // limitations of VBScript. Not perfect, but better than a stick in the eye.
  8. //
  9. // use cl /EP foo.vbt > foo.vbs to expand the template
  10. const SCRIPT_FILENAME = "test-DsRole.vbs"
  11. const SCRIPT_SOURCE_NAME = __FILE__
  12. const SCRIPT_DATE = __DATE__
  13. const SCRIPT_TIME = __TIME__
  14. // this is all our common code.
  15. #include "common.vbi"
  16. Main
  17. wscript.quit(0)
  18. sub Main
  19. On Error Resume Next
  20. Dim srvwiz
  21. Set srvwiz = CreateObject("ServerAdmin.ConfigureYourServer")
  22. dim i
  23. i = srvwiz.DsRole(0)
  24. if Err.Number then DumpErrAndQuit
  25. echo i
  26. if i = 1 Then
  27. Echo "machine is a DC"
  28. else
  29. Echo "machine is not a DC"
  30. end if
  31. i = srvwiz.DsRole(1)
  32. if Err.Number then DumpErrAndQuit
  33. echo i
  34. if i = 1 Then
  35. Echo "machine needs to complete dc upgrade"
  36. else
  37. Echo "machine does not need to complete dc upgrade"
  38. end if
  39. i = srvwiz.DsRole(2)
  40. if Err.Number then DumpErrAndQuit
  41. echo i
  42. if i = 1 Then
  43. Echo "no role change is taking place"
  44. elseif i = 2 then
  45. Echo "dcpromo is running"
  46. elseif i = 3 then
  47. Echo "dcpromo was run, but machine needs to be restarted."
  48. end if
  49. End sub