windows-nt/Source/XPSP1/NT/admin/cys/test/test-dsrole.vbt

71 lines
1.4 KiB
Plaintext
Raw Normal View History

2020-09-26 03:20:57 -05:00
'
' Test IConfigureYourServer::DsRole
'
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-DsRole.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
Dim srvwiz
Set srvwiz = CreateObject("ServerAdmin.ConfigureYourServer")
dim i
i = srvwiz.DsRole(0)
if Err.Number then DumpErrAndQuit
echo i
if i = 1 Then
Echo "machine is a DC"
else
Echo "machine is not a DC"
end if
i = srvwiz.DsRole(1)
if Err.Number then DumpErrAndQuit
echo i
if i = 1 Then
Echo "machine needs to complete dc upgrade"
else
Echo "machine does not need to complete dc upgrade"
end if
i = srvwiz.DsRole(2)
if Err.Number then DumpErrAndQuit
echo i
if i = 1 Then
Echo "no role change is taking place"
elseif i = 2 then
Echo "dcpromo is running"
elseif i = 3 then
Echo "dcpromo was run, but machine needs to be restarted."
end if
End sub