Announcement

Collapse
No announcement yet.

Exchange Relay List - Change vbs script report to text file?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Exchange Relay List - Change vbs script report to text file?

    Hi,

    I'm not any good with scripting so thankfully Microsoft have provided a script to dump out the relay lists (among other things) but it seems to only print to screen. Is it possible to change this so it can dump to a file maybe?

    The link to the script is here (LINK)

    Many thanks for any assistance.
    cheers
    Andy

    Please read this before you post:


    Quis custodiet ipsos custodes?

  • #2
    Re: Exchange Relay List - Change vbs script report to text file?

    VBScripts may be run in either GUI mode (WScript.exe) or command line mode (CScript.exe)
    Running the script with CScript in a dosbox you can redirect output to a file.

    Run the following command line via Start | Run or, by using a shortcut:
    Code:
    CMD.exe /c CSCRIPT.exe //nologo "pathto\script.vbs" /arguments >"c:\outputfile.txt"
    \Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: Exchange Relay List - Change vbs script report to text file?

      That worked a treat, I have much to learn! Many thanks Rems.
      cheers
      Andy

      Please read this before you post:


      Quis custodiet ipsos custodes?

      Comment


      • #4
        Re: Exchange Relay List - Change vbs script report to text file?

        Glad to be of help.

        \Rems


        Just in case anyone might be interested,
        the batch below execute the vbsfile and will not only redirect the output to a file but to the screen as well in real mode (like Unix's "tee" function does).

        Code:
        :: save this batch in the same folder as the vbsfile
        
        @echo off
        SetLocal & color 6a
        
        PushD "%0\..\"
        :: the active folder is now "%CD%"
        
        Set "vbsfile=scriptname.vbs"
        (Set ScriptArgs=-n)
        Set "outFile=outputfile.txt"
        
        rem Set "CmdShell=%windir%\system32\cmd.exe /c"
        
        (call:TEE %0 %1)&exit/b
        
        :run
        title RUNNING  %vbsfile%
        
        %ScriptHost% "%vbsfile%" %ScriptArgs%
        
        title Finished
        
        echo/&echo/
        <nul (Set /P j=%date% )&time/t
        echo/ ^> output saved to  %outFile%
        
        (call:CleanUp)
        PopD
        
        echo/
        echo/- end -&(pause>nul)
        
        EndLocal
        
        
        GoTO:EOF ---------------------------------------------------------------
        :TEE Subroutine  (Handling Input and Output)
        Set "ScriptHost=%windir%\system32\cscript.exe //nologo"
        SET "TFile=%temp%.\TEE.vbs"
        (SET Batch=%1&SET $$$=%2)
        If /i Not [%$$$%]==[/TEE] (
            >"%TFile%" (
              echo/Dim str
              echo/Do While Not WScript.StdIn.AtEndOfStream
              echo/  str = WScript.StdIn.ReadLine
              echo/  If LCase(str^) = LCase("quitTee"^) then Exit Do
              echo/  WScript.StdOut.WriteLine str
              echo/  WScript.StdErr.WriteLine str
              echo/Loop
          )
          echo/ >>"%TFile%"
          %Batch% /TEE | %ScriptHost% "%TFile%" >"%outFile%"
          goto eof
        ) ELSE (goto run)
        GoTO:EOF ---------------------------------------------------------------
        :CleanUp Subroutine
        (ping 127.0.0.1 -n 3 & Del "%TFile%")>NUL
        GoTO:EOF ---------------------------------------------------------------
        Last edited by Rems; 13th November 2008, 13:28.

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment

        Working...
        X