VBscript to Check Schema has been updated on Domain Controllers

To Introduce new Windows 2008 Additional domain controller we have to forest and domain. As part of the forest preparation we run the commaind adprep /Forestprep. Its recommended to run this command on the Schema Master Server


Below VBscript  will check on all the DCs for Schema update on the servername which are given in the file serverlist.  Script result will confirm if schema is updated successful or failed on the servers.


Dim objShell
set objShell = wscript.createObject(“wscript.shell”)

Set filesys = CreateObject(“Scripting.FileSystemObject”)
set filetxt1 = filesys.OpenTextFile(“C:\serverlist.txt”,1)

do Until filetxt1.AtEndOfStream
 Servername = filetxt1.Readline
 servername = trim(Servername)
 iReturn = objShell.Run(“CMD /C psexec.exe \\” & servername & ” schupgr > log.txt”, , True)
 Set filesys = CreateObject(“Scripting.FileSystemObject”)
 set filetxt = filesys.OpenTextFile(“C:\log.txt”,1)
 K = 0
 str = “Current Schema Version is 44”
 do Until filetxt.AtEndOfStream
  LineVerify = filetxt.Readline
  LineVerify = trim(LineVerify)
  If InStr(UCase(LineVerify), Ucase(“Current Schema Version is 44”)) Then
   K = 1
  End If

 if iReturn = 1 AND K = 1 Then

  wscript.echo servername & “: Success”
  wscript.echo servername &”: Failure”
 End If



Find the copy of the script in the below link


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s