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.

55 lines
1.2 KiB

  1. '
  2. ' Test IConfigureYourServer::SetStaticIpAddressAndSubnetMask
  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-SetStaticIpAddressAndSubnetMask.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. if wscript.arguments.count <> 2 then
  21. Echo "supply an IP address and subnet mask"
  22. Exit sub
  23. end if
  24. Echo "addr = " & wscript.arguments.item(0)
  25. Echo "mask = " & wscript.arguments.item(1)
  26. Dim srvwiz
  27. Set srvwiz = CreateObject("ServerAdmin.ConfigureYourServer")
  28. dim i
  29. i = srvwiz.SetStaticIpAddressAndSubnetMask(wscript.arguments.item(0), wscript.arguments.item(1))
  30. if Err.Number then DumpErrAndQuit
  31. echo i
  32. if i Then
  33. Echo "IP configuration succeeded"
  34. else
  35. Echo "IP configuration failed"
  36. end if
  37. End sub