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.
|
|
' ' Test IConfigureYourServer::ValidateName '
option explicit
// this is a Visual Basic Script "Template", used in conjunction with the // MS Visual C++ Preprocessor to overcome some of the source management // limitations of VBScript. Not perfect, but better than a stick in the eye. // // use cl /EP foo.vbt > foo.vbs to expand the template
const SCRIPT_FILENAME = "test-ValidateName.vbs" const SCRIPT_SOURCE_NAME = __FILE__ const SCRIPT_DATE = __DATE__ const SCRIPT_TIME = __TIME__
// this is all our common code.
#include "common.vbi"
Main wscript.quit(0)
sub Main On Error Resume Next
if wscript.arguments.count <> 1 then Echo "supply a name to validate" Exit sub end if
Echo "Validating " & wscript.arguments.item(0)
Dim srvwiz Set srvwiz = CreateObject("ServerAdmin.ConfigureYourServer")
Dim nameTypes(1) nameTypes(0) = "DNS" nameTypes(1) = "NetBios"
Dim resultCodes(6) resultCodes(0) = "Illegal Input" resultCodes(1) = "Name Too Long" resultCodes(2) = "Numeric Name" resultCodes(3) = "Name Contains Bad Characters" resultCodes(4) = "Malformed Name" resultCodes(5) = "Name Valid, In Use" resultCodes(6) = "Name Valid, Available" Dim i Dim j For i = 0 to Ubound(nameTypes) Err.Clear Echo "Validating " & wscript.arguments.item(0) & " as " & nameTypes(i) j = srvWiz.ValidateName(nameTypes(i), wscript.arguments.item(0)) If Err.Number then DumpErrAndQuit
Echo j Echo resultCodes(j) Next End sub
|