HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/downloads/surinder/HMSSettingsDiagnostics/HMSSettingsDiagnostics.vbs
Option Explicit
Dim RoutineVer : RoutineVer = "v1.48"
' This routine extracts and reports all main settings from the running
' Hmailserver instance found at the specified host server. No personal
' information is identified or reported. The latest report should always
' be used where possible as found at the Hmailserver forum:
' https://www.hmailserver.com/forum/viewtopic.php?f=20&t=30914
' Author: jimimaseye

' Set up authentication
dim obApp, obUtilities, objFSO, objTextFile, wshShell, PwdIntro, strServer, strPassword, PathStore, Tempfile, TempOutFile
dim Prot, ConSec, Result, strRegEx, Cipherlist, Cipher
PwdIntro = RoutineVer & vbcrlf & vbcrlf & "This routine will collate certain information for diagnostic purposes. " & _
 "Once ran, the resultant file contents can be copy/pasted in to the forum (or the file attached) for further analysis and help." & vbcrlf & vbcrlf & _
 "NO SENSITIVE INFORMATION IS RECORDED, saved or disclosed. Do not modify the results in any way." & vbcrlf & vbcrlf & _
 "Please enter your Hmailserver admin password (Warning: input is NOT masked):"
PWDInput(PwdIntro)
if not isEmpty(strPassword) then' password entered to authenticate
   strServer = InputBox("Please enter your Hmailserver server name/IP address (blank for default 'localhost'):", "localhost")
   Set obApp = CreateObject("hMailServer.Application", strServer)
   Call obApp.Authenticate("Administrator", strPassword)
   
   ' Set up Outfile
   Set wshShell = CreateObject( "WScript.Shell" )
   PathStore = wshShell.ExpandEnvironmentStrings( "%TEMP%" )
   Set obUtilities = CreateObject("hMailServer.Utilities")
   Set objFSO = CreateObject("Scripting.FileSystemObject")
   Tempfile = "HMSDiagnostic_" & ((year(now)*100 + month(now))*100 + day(now))*10000 + hour(now)*100 + minute(now) & ".txt"
   TempOutFile = PathStore & "\" & Tempfile
   
   Set objTextFile = objFSO.OpenTextFile(TempOutFile, 2, true)

   dim oTarget, j, x, A, Txt, oAntispam, oDomain, oAntivirus, AutoBanRanges

   objTextFile.WriteLine("[size=85][code]" & now() & "   Hmailserver: " & obApp.Version & vbcrlf)

   ' IP RANGES
   strRegEx = "(^127\.)|(^192\.168\.)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^::1$)|(^[fF][cCdD])"
   For j = 0 to obApp.settings.SecurityRanges.count -1
'   On Error Resume Next
      set oTarget = obApp.settings.SecurityRanges.item(j)
      if oTarget.Expires = False then
         Txt = "IP: " & oTarget.LowerIP & " - " & oTarget.UpperIP & _
          "     Priority: " & oTarget.priority &  _
          "     Name: " & oTarget.Name & vbcrlf & vbcrlf &  _
          "  Allow connections                         Other" & vbcrlf & _
          "     SMTP: " & RJust(BooTrans(oTarget.AllowSMTPConnections),6)
         if not obApp.settings.ServiceSMTP and oTarget.AllowSMTPConnections then
            Txt = Txt & " !! Protocol DISABLED !! " & space(2)
         else
            Txt = Txt & "     " & space(11) & space(11)
         End if
         Txt = Txt & "   Antispam : " & RJust(BooTrans(oTarget.EnableSpamProtection),6)
         if oTarget.EnableSpamProtection and ( not obApp.settings.Antispam.UseSPF and not obApp.settings.Antispam.SpamAssassinEnabled _
          and not obApp.settings.Antispam.CheckHostInHelo and not obApp.settings.Antispam.UseMXChecks _
          and not obApp.settings.Antispam.DKIMVerificationEnabled ) then Txt = Txt & " ! 'Spam tests' not enabled !"
         Txt = Txt & vbcrlf & "     POP3: " & RJust(BooTrans(oTarget.AllowPOP3Connections),6)
         if not obApp.settings.ServicePOP3 and oTarget.AllowPOP3Connections then 
            Txt = Txt & " !! Protocol DISABLED !! " & space(2)
         else
            Txt = Txt & "     " & space(11) & space(11)
         End if
         Txt = Txt & "   Antivirus: " & RJust(BooTrans(oTarget.EnableAntiVirus),6)
         if oTarget.EnableAntiVirus and ( not obApp.settings.antivirus.ClamAVenabled and not obApp.settings.antivirus.Clamwinenabled _
          and not obApp.settings.antivirus.customscannerenabled ) then Txt = Txt & " !! ANTIVIRUS NOT CONFIGURED !!"
         Txt = Txt & vbcrlf & "     IMAP: " & RJust(BooTrans(oTarget.AllowIMAPConnections),6)
         if not obApp.settings.ServiceIMAP and oTarget.AllowIMAPConnections then
            Txt = Txt & " !! Protocol DISABLED !! " & space(2)
         else
            Txt = Txt & "     " & space(11) & space(11)
         End if
         'if obApp.Version > "5.5" then Txt = Txt & "   SSL/TLS:   " & RJust(BooTrans(oTarget.RequireSSLTLSForAuth),6)
         Txt = Txt & "   SSL/TLS:   " & RJust(BooTrans(oTarget.RequireSSLTLSForAuth),6)
         Txt = Txt & vbcrlf & vbcrlf & _
          "  Allow Deliveries from                     Require Authentication from" & vbcrlf & _
          "     Local To Local       -" & RJust(BooTrans(oTarget.AllowDeliveryFromLocalToLocal),6) & space(11)
         if oTarget.AllowDeliveryFromLocalToLocal then   Txt = Txt & "   Local To Local       -" & RJust(BooTrans(oTarget.RequireSMTPAuthLocalToLocal),6)
         Txt = Txt & vbcrlf & "     Local To External    -" & RJust(BooTrans(oTarget.AllowDeliveryFromLocalToRemote),6) & space(11)
         if oTarget.AllowDeliveryFromLocalToRemote then  Txt = Txt & "   Local To External    -" & RJust(BooTrans(oTarget.RequireSMTPAuthLocalToExternal),6)
         Txt = Txt & vbcrlf & "     External To Local    -" & RJust(BooTrans(oTarget.AllowDeliveryFromRemoteToLocal),6) & space(11)
         if oTarget.AllowDeliveryFromRemoteToLocal then  Txt = Txt & "   External To Local    -" & RJust(BooTrans(oTarget.RequireSMTPAuthExternalToLocal),6)
         Txt = Txt & vbcrlf & "     External To External -" & RJust(BooTrans(oTarget.AllowDeliveryFromRemoteToRemote),6) & space(11)
         if oTarget.AllowDeliveryFromRemoteToRemote then Txt = Txt & "   External To External -" & RJust(BooTrans(oTarget.RequireSMTPAuthExternalToExternal),6)
         Txt = Txt & vbcrlf & vbcrlf
         objTextFile.WriteLine(txt)
      Else
         If Lookup(strRegEx, oTarget.LowerIP) Then
            AutoBanRanges = AutoBanRanges & LJust("    " & oTarget.LowerIP, 25) & "Expires : " & oTarget.ExpiresTime & vbcrlf
         End if
      End if
   Next
	if not obApp.settings.DefaultDomain = "" then objTextFile.WriteLine("   !!  Warning:  DEFAULT DOMAIN is SET  !!")
   ' End IP RANGES

   ' AUTOBANNED PRIVATE addresses
   Txt = string(54,"-") & vbCrLf
   Txt = Txt & "AUTOBANNED Local Addresses:" & vbcrlf
   if AutoBanRanges= "" then AutoBanRanges = "    No entries" & vbcrlf
   Txt = Txt & AutoBanRanges & vbcrlf
   Txt = Txt &  string(95,"-") & vbCrLf
   objTextFile.WriteLine(txt)
   ' END SYSTEM TESTS

   'AUTOBAN
   Txt = "AUTOBAN" & vbcrlf 
   set oTarget = obApp.settings

   Txt = Txt & "  Autoban Enabled: " & BooTrans(oTarget.AutoBanOnLogonFailure)
   If oTarget.AutoBanOnLogonFailure then
      Txt = Txt & space(7) & "Max invalid logon attempts: " & RJust(oTarget.MaxInvalidLogonAttempts,6) & vbcrlf
      Txt = Txt & space(30) & "Minutes Before Reset:       " & RJust(oTarget.MaxInvalidLogonAttemptsWithin,6) & "  (" & _
      formatNumber(oTarget.MaxInvalidLogonAttemptsWithin/60,2) & " hours, " & FormatNumber(oTarget.MaxInvalidLogonAttemptsWithin/1440,2) & " days)" & vbcrlf
      Txt = Txt & space(30) & "Minutes to Autoban:         " & RJust(oTarget.AutoBanMinutes,6) & "  (" & _
      formatNumber(oTarget.AutoBanMinutes/60,2) & " hours, " & FormatNumber(oTarget.AutoBanMinutes/1440,2) & " days)" & vbcrlf
   End if
   If not oTarget.AutoBanOnLogonFailure then Txt = Txt & vbcrlf
   Txt = Txt &  vbcrlf& obApp.Diagnostics.PerformTests.Item(4).Executiondetails
   Txt = Txt & string(95,"-") & vbcrlf
   objTextFile.WriteLine(txt)
   ' END AUTOBAN

   ' INCOMING RELAYS
   Txt = "INCOMING RELAYS" & vbcrlf 
   For j = 0 to obApp.settings.IncomingRelays.count -1
      set oTarget = obApp.settings.IncomingRelays.item(j)
      Txt = Txt & space(20) &  LJust(oTarget.LowerIP,15) &  "  -   "  & oTarget.UpperIP & vbcrlf
   Next
      If j = 0 then Txt = Txt & "   No entries" & vbcrlf
   Txt = Txt & string(95,"-") & vbcrlf
   objTextFile.WriteLine(txt)
   'End INCOMING RELAYS

   'ANTISPAM
   set oAntispam = obApp.settings.antispam
   Txt = "ANTISPAM" & vbcrlf & vbcrlf & "GENERAL                              SPAM TESTS              Score   SPAMASSASSIN" & vbcrlf & _
    "  Spam Mark:                  " & LJust(oAntispam.SpamMarkThreshold,4) & "    Use SPF:          " & _
    RJust(BooTrans(oAntispam.UseSPF),6) & " - " & oAntispam.UseSPFScore & "    Use Spamassassin:  " & RJust(BooTrans(oAntispam.SpamAssassinEnabled),6) & vbcrlf & _
    "  Add X-HmailServer-Spam:   " & RJust(BooTrans(oAntispam.AddHeaderSpam),6) & "    Check HELO host:  " & _
    RJust(BooTrans(oAntispam.CheckHostInHelo),6) & " - " & oAntispam.CheckHostInHeloScore 
   if oAntispam.SpamAssassinEnabled then Txt = Txt & "    Hostname: " & RJust(oAntispam.SpamAssassinHost,15) & vbcrlf else Txt = Txt & vbcrlf
   Txt = Txt & "  Add X-HmailServer-Reason: " & RJust(BooTrans(oAntispam.AddHeaderReason),6) & "    Check MX records: " & _
    RJust(BooTrans(oAntispam.UseMXChecks),6) &  " - " & oAntispam.UseMXChecksScore
   if oAntispam.SpamAssassinEnabled then Txt = Txt & "    Port: " & RJust(oAntispam.SpamAssassinPort,19) & vbcrlf else Txt = Txt & vbcrlf
   Txt = Txt & "  Add X-HmailServer-Subject:" & RJust(BooTrans(oAntispam.PrependSubject),6) & "    Verify DKIM:      " & _
    RJust(BooTrans(oAntispam.DKIMVerificationEnabled),6) & " - " & oAntispam.DKIMVerificationFailureScore
   if oAntispam.SpamAssassinEnabled then
      Txt = Txt & "    Use SA score: "
      if oAntispam.SpamAssassinMergeScore then Txt = Txt & RJust(BooTrans(oAntispam.SpamAssassinMergeScore),11) else Txt = Txt & oAntispam.SpamAssassinMergeScore
      if oAntispam.SpamAssassinMergeScore = false then Txt = Txt & " - " & RJust(oAntispam.SpamAssassinScore,3)
   End if
   Txt = Txt & vbcrlf
   if oAntispam.PrependSubject then Txt = Txt  & "              Subject Text: """ & oAntispam.PrependSubjectText & """"
   Txt = Txt & vbcrlf & _
    "  Spam delete threshold: " & oAntispam.SpamDeleteThreshold & "         Maximum message size: " & oAntispam.MaximumMessageSize & vbcrlf & vbcrlf & _
    "GREYLISTING:" & vbcrlf & "  Greylisting: " & RJust(BooTrans(oAntispam.GreyListingEnabled),6)
   If oAntispam.GreyListingEnabled then Txt = Txt & "       Defer mins: " & oAntispam.GreyListingInitialDelay & "       Days Unused: " & _
    oAntispam.GreyListingInitialDelete/24 & "      Days Used: " & oAntispam.GreyListingFinalDelete/24 & vbcrlf & space(28) & _
    "Bypass SPF: " & LJust(BooTrans(oAntispam.BypassGreylistingOnSPFSuccess),6) & "   Bypass A/MX: " & oAntispam.BypassGreylistingOnMailFromMX & vbcrlf
   Txt = Txt & vbcrlf

   ' Begin GreylistWhitelisting
   If oAntispam.GreyListingEnabled then
      Txt = Txt & "Greylist WHITELIST ENTRIES:" & vbcrlf
      For j = 0 to oAntispam.GreyListingWhiteAddresses.count -1
         set oTarget = oAntispam.GreyListingWhiteAddresses.item(j)
         Txt = Txt & "   IP Address: " &  oTarget.IPAddress & vbcrlf
      Next
      If j = 0 then Txt = Txt & "   No entries" & vbcrlf
      Txt = Txt & vbcrlf
      Txt = Txt & "Greylist DOMAINS enabled:" & vbcrlf
      x = 0
      For j = 0 To obApp.Domains.Count - 1
         Set oDomain = obApp.Domains.Item(j)
         If oDomain.Active and oDomain.AntiSpamEnableGreylisting Then
            Txt = Txt & "           " &  oDomain.name & vbcrlf
            x = x + 1
            For A = 0 To oDomain.DomainAliases.Count -1
               Txt = Txt & "                 |--   " & oDomain.DomainAliases.Item(A).Aliasname & vbcrlf
            Next
         End if
      Next
      If x = 0 then Txt = Txt & "   No entries" & vbcrlf
   End if
   x = 0
   Txt = Txt & vbcrlf
   ' End greylisting
   ' Begin DNSBL
   Txt = Txt & "DNSBL ENTRIES:" & vbcrlf
   For j = 0 to oAntispam.DNSBlackLists.count -1
      set oTarget = oAntispam.DNSBlackLists.item(j)
      if oTarget.active then
         Txt = Txt & "    " &  RJust(oTarget.DNSHost,30) & "      Score: " & oTarget.score & _
         "     Result: " & oTarget.ExpectedResult & vbcrlf
         x = x + 1
      End if
   Next
   If x = 0 then Txt = Txt & "   No entries" & vbcrlf 
   x = 0
   Txt = Txt & vbcrlf
   ' End DNSBL
   ' Begin SURBL
   Txt = Txt & "SURBL ENTRIES:" & vbcrlf
   For j = 0 to oAntispam.SURBLServers.count -1
      set oTarget = oAntispam.SURBLServers.item(j)
      if oTarget.active then
         Txt = Txt & "    " &  RJust(oTarget.DNSHost,30) & "      Score: " & oTarget.score & vbcrlf
         x = x + 1
      End if
   Next
   If x = 0 then Txt = Txt & "   No entries" & vbcrlf
   x = 0
   ' End surbl
   Txt = Txt & string(95,"-") & vbcrlf
   objTextFile.WriteLine(txt)
   ' End ANTISPAM

   ' WHITELISTING
   Txt = "WHITELISTING" & vbcrlf
   For j = 0 to obapp.Settings.AntiSpam.WhiteListAddresses.count -1
      set oTarget = obapp.Settings.AntiSpam.WhiteListAddresses.item(j)
      Txt = Txt & "              " & LJust(oTarget.LowerIPAddress,15) & "    to    " & LJust(oTarget.UpperIPAddress,15) & _
      "              " & oTarget.EmailAddress &vbcrlf
   Next
   If j = 0 then Txt = Txt & "   No entries" & vbcrlf
   Txt = Txt & string(95,"-") & vbcrlf
   objTextFile.WriteLine(txt)
   ' End WHITELISTING

   'ANTIVIRUS
   set oAntivirus = obApp.settings.antivirus
   Txt = "ANTIVIRUS"
   if oAntivirus.ClamAVenabled or oAntivirus.Clamwinenabled or oAntivirus.customscannerenabled then
      Txt = Txt & vbcrlf & vbcrlf & "GENERAL:" & vbcrlf &  "  When found - "
      if oAntivirus.action = 0 then 
         Txt = Txt & "Delete email. Notify Sender: " & BooTrans(oAntivirus.NotifySender) & ",  Notify Receiver: " & BooTrans(oAntivirus.NotifyReceiver) & vbcrlf
      Else
         Txt = Txt & "Delete Attachments." & vbcrlf
      End if 
      Txt = Txt & vbcrlf & "  Max Message Size: " & oAntivirus.MaximumMessageSize & vbcrlf
      Txt = Txt & "     CLAM AV:   " & BooTrans(oAntivirus.ClamAVenabled)
      if oAntivirus.ClamAVenabled then
         if oAntivirus.clamwinenabled then Txt = Txt & "   !!!! CONFLICT !!!!"
         if oAntivirus.customscannerenabled Then Txt = Txt & "   !! MULTIPLE AV !!"
         Txt = Txt & "       Hostname: " & oAntivirus.ClamAVHost & "    Port: " & oAntivirus.ClamAVPort
      End if
      Txt = Txt & vbcrlf
      Txt = Txt & "     CLAMWIN:   " & BooTrans(oAntivirus.Clamwinenabled)
      if oAntivirus.Clamwinenabled then
         if oAntivirus.clamAVenabled then Txt = Txt & "   !!!! CONFLICT !!!!"
         if oAntivirus.customscannerenabled Then Txt = Txt & "   !! MULTIPLE AV !!"
         Txt = Txt & "       Executable: " & oAntivirus.clamwinexecutable & "    Path: " & oAntivirus.clamwindbfolder
      End if
      Txt = Txt & vbcrlf
      Txt = Txt & "     CUSTOMAV:  " & BooTrans(oAntivirus.customscannerenabled)
      if oAntivirus.customscannerenabled then
         if oAntivirus.clamwinenabled or oAntivirus.clamAVenabled then Txt = Txt & "   !! MULTIPLE AV !!"
         Txt = Txt & "       Executable: " & oAntivirus.customscannerexecutable & "    ReturnValue: " & oAntivirus.customscannerreturnvalue & vbcrlf
      End if 
   else
      Txt = Txt & ":  No application configured."
   End if
   Txt = Txt & vbcrlf & vbcrlf & "  Block Attachments: " & BooTrans(oAntivirus.EnableAttachmentBlocking) & vbcrlf
   if oAntivirus.EnableAttachmentBlocking then
      For j = 0 to oAntivirus.BlockedAttachments.count -1
         set oTarget = oAntivirus.BlockedAttachments.item(j)
         Txt = Txt & space(15) & LJust(oTarget.WildCard,10) & space(8) & oTarget.Description & vbcrlf
         x = x + 1
      Next
      If x = 0 then Txt = Txt & "   No entries" & vbcrlf
      x = 0
   End if
   Txt = Txt & string(95,"-") & vbcrlf
   objTextFile.WriteLine(txt)
   ' End ANTIVIRUS

   'SSLTLS
   Txt = "SSL/TLS" & vbcrlf 
   set oTarget = obApp.settings
   Txt = Txt & space(13) & "SSL 3.0 : " & RJust(BooTrans(oTarget.SslVersion30Enabled),6) & vbcrlf
   Txt = Txt & space(13) & "TLS 1.0 : " & RJust(BooTrans(oTarget.TlsVersion10Enabled),6) & vbcrlf
   Txt = Txt & space(13) & "TLS 1.1 : " & RJust(BooTrans(oTarget.TlsVersion11Enabled),6) & vbcrlf
   Txt = Txt & space(13) & "TLS 1.2 : " & RJust(BooTrans(oTarget.TlsVersion12Enabled),6) & space(15) & _
    " Verify Remote SSL/TLS Certs: " & RJust(BooTrans(oTarget.VerifyRemoteSslCertificate),6) & vbcrlf
   Txt = Txt & "SslCipherList  :" & vbcrlf & vbcrlf
   CipherList = Split(oTarget.SslCipherList, ":")
   X=0
   For Each Cipher in CipherList
      X = X + 1
      if not (X mod 3) = 1 then Txt = Txt & "- "
      Txt = Txt & LJust(Cipher,32)
      if (X mod 3) = 0 then Txt = Txt & vbcrlf 
   Next
   Txt = Txt & string(95,"-") & vbcrlf
   objTextFile.WriteLine(txt)
   ' END SSLTLS

   ' TCPIP ports
   Txt = "TCPIP PORTS" & space(41) & "Connection Sec" & vbcrlf
   For j = 0 to obApp.settings.TCPIPPorts.count -1
      set oTarget = obApp.settings.TCPIPPorts.item(j)
      Select Case oTarget.protocol
         Case 1
             Prot = "SMTP"
         Case 3
             Prot = "POP3"
         Case 5
             Prot = "IMAP"
         Case Else
             Prot = "<script error>"
      End Select
      Select Case oTarget.ConnectionSecurity
         Case 0
             ConSec = "None"
         Case 1
             ConSec = "SSL/TLS"
         Case 2
             ConSec = "StartTLS Optional"
         Case 3
             ConSec = "StartTLS Required"
         Case Else
             ConSec = "<script error>"
      End Select
      Txt = Txt & space(15) & LJust(oTarget.Address,15) & " / " & LJust(oTarget.PortNumber, 5) & " / " & Prot & "   -   " & _
      ConSec & vbcrlf
   Next
   Txt = Txt & string(95,"-") & vbcrlf
   objTextFile.WriteLine(txt)
   ' END TCPIP Ports

   'LOGGING
   set oTarget = obApp.settings.Logging
   Txt = "LOGGING      Logging Enabled: " & BooTrans(oTarget.Enabled) & vbcrlf & vbcrlf
   Txt = Txt & "  Paths:-   Current:  " & oTarget.CurrentDefaultLog & vbcrlf
   Txt = Txt & space(12) & "Error:    " & oTarget.CurrentErrorLog & vbcrlf
   Txt = Txt & space(12) & "Event:    " & oTarget.CurrentEventLog & vbcrlf
   Txt = Txt & space(12) & "Awstats:  " & oTarget.CurrentAwstatsLog & vbcrlf
   if oTarget.Enabled then 
      Txt = Txt & space(24) & "APPLICATION -  "
      if oTarget.LogApplication then Txt = Txt & RJust(BooTrans(oTarget.LogApplication),6) else Txt = Txt & "    ."
      Txt = Txt & vbcrlf & space(24) & "SMTP        -  "
      if oTarget.LogSMTP then Txt = Txt & RJust(BooTrans(oTarget.LogSMTP),6) else Txt = Txt & "    ."
      Txt = Txt & vbcrlf & space(24) & "POP3        -  "
      if oTarget.LogPOP3 then Txt = Txt & RJust(BooTrans(oTarget.LogPOP3),6) else Txt = Txt & "    ."
      Txt = Txt & vbcrlf & space(24) & "IMAP        -  "
      if oTarget.LogIMAP then Txt = Txt & RJust(BooTrans(oTarget.LogIMAP),6) else Txt = Txt & "    ."
      Txt = Txt & vbcrlf & space(24) & "TCPIP       -  "
      if oTarget.LogTCPIP then Txt = Txt & RJust(BooTrans(oTarget.LogTCPIP),6) else Txt = Txt & "    ."
      Txt = Txt & vbcrlf & space(24) & "DEBUG       -  "
      if oTarget.LogDebug then Txt = Txt & RJust(BooTrans(oTarget.LogDebug),6) else Txt = Txt & "    ."
      Txt = Txt & vbcrlf & space(24) & "AWSTATS     -  "
      if oTarget.AWStatsEnabled then Txt = Txt & RJust(BooTrans(oTarget.AWStatsEnabled),6) & vbcrlf else Txt = Txt & "    ." & vbcrlf
   End if
   Txt = Txt &  string(95,"-") & vbCrLf
   objTextFile.WriteLine(txt)
   ' End of LOGGING

   ' SYSTEM TESTS
   Txt = "SYSTEM TESTS" & vbcrlf& vbcrlf
   For j = 0 To obApp.Diagnostics.PerformTests.Count -1
      if j = 0 then
         Txt = Txt & mid(obApp.Diagnostics.PerformTests.Item(j).Executiondetails, _
          instr(obApp.Diagnostics.PerformTests.Item(j).Executiondetails,"Database type"),35) & vbcrlf
      Else
         if not j = 4 then  ' 4 already reported as AUTOBAN count
            Txt = Txt &  obApp.Diagnostics.PerformTests.Item(j).Executiondetails & vbcrlf
            if j = 2 then Txt = Txt & vbcrlf
         End if
      End if
   Next
   Txt = Txt &  string(95,"-") & vbCrLf
   objTextFile.WriteLine(txt)
   ' End SYSTEM tests

   ' Close outfile and finish
   If Err.Number = 438 Then
      objTextFile.WriteLine("Error " & Err.Number & ". Out-dated version. Some fields or objects missing." & vbcrlf  )
      Err.Clear
   End If
   on error goto 0
   objTextFile.WriteLine("[/code][/size][size=80]Generated by HMSSettingsDiagnostics " & RoutineVer & ", Hmailserver " & _
    "[url=https://www.hmailserver.com/forum/viewtopic.php?f=20&t=30914]Forum[/url].[/size]")
   objTextFile.Close

   result=Msgbox(vbcrlf & vbcrlf & "Diagnostic output file: " & vbcrlf & vbcrlf & "%temp%\" & TempFile & vbcrlf & vbcrlf & "has been created." & _
   vbcrlf & vbcrlf & _
    "No sensitive information is contained in this report." & vbcrlf & vbcrlf & "Click OK to open it in the default text viewer " & _
    "(or prompt you to open it). Copy/paste the contents (CTRL-A to select), or upload the file, " & _
    "to the forum as a 'REPLY' for further help." & vbcrlf & vbcrlf & "NOTE:  When posting to forum, please do NOT apply formatting.",vbOKOnly+vbInformation, "")

    dim objNotes
   Set objNotes = CreateObject("Shell.Application")
   objNotes.Open(TempOutFile)
End if ' if authenticated

Function BooTrans(ColumnValue)
    BooTrans = "False"
    if ColumnValue then BooTrans = "True"
End Function

Function RJust(ColumnValue, ColumnWidth)
   If columnwidth >= Len(columnvalue) Then
      RJust = Space(ColumnWidth - Len(ColumnValue)) & ColumnValue
   Else
      RJust = Trim(Columnvalue)
   End If
End Function

Function LJust(ColumnValue, ColumnWidth)
   If columnwidth >= Len(columnvalue) Then
      LJust = ColumnValue & Space(ColumnWidth - Len(ColumnValue))
   Else
      LJust = Trim(Columnvalue)
   End If
End Function

Function Lookup(strRegEx, strMatch)
   With CreateObject("VBScript.RegExp")
      .Global = False
      .Pattern = strRegEx
      .IgnoreCase = True
      If .Test(strMatch) Then
         Lookup = True
      Else
         Lookup = False
      End If
   End With
End Function

Function PWDInput(PwdIntro)
   strPassword = InputBox( PwdIntro , "Admin password")
   if not isEmpty(strPassword) and strPassword = "" then 
      result=Msgbox("!!  ADMIN PASSWORD CANNOT BE BLANK  !!",vbOKOnly+vbCritical, "")
      PWDInput(PwdIntro)
   End If
End Function