Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Sub SMTP_STATUS ' this is a subroutine, but could be a function that returns the SMPT status Dim strCommand Dim intSMPTStatus Dim intDosError ' the DOS command will be to query the SMTPSVC status ' I could not figure out how to get the strCommand = "CMD /C SC QUERY SMTPSVC" intStyle = 10 intDOSError = 0 intSMTPStatus = 0 Dim fldTemp, strTempName set fsoRun = CreateObject("Scripting.FileSystemObject") Set fldTemp = fsoRun.GetSpecialFolder(TEMP_FOLDER) strTempName = fldTemp.Path & "\" & fsoRun.GetTempName Dim WshShell Set WshShell = CreateObject("Wscript.Shell") Return = WshShell.Run(strCommand & " >" & strTempName, intStyle, True ) 'Get the output from the command Dim filOutput Set filOutput = fsoRun.OpenTextFile(strTempName, FOR_READING) While Not filOutput.AtEndOfStream strOutput = filOutput.ReadLine objEntry.WriteLine (strOutput) ' This is where I would like to get the SMTP status If InStr(strOutput,"STATE") > 0 And InStr(strOutput,"RUNNING") > 0 Then ' If the status of SMPTSVC is running then flag it as 1 intSMPTStatus = 1 End If Wend filOutput.Close intDOSError = Return 'Delete the temporary file fsoRun.DeleteFile strTempName Set WshShell = Nothing End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Shared Folder on the web servers running Windows server 2012 is not able to recognize any shared folders.||6||76|
|How to resolve run time error "1004" name more than 31 charaters long||12||64|
|Excel VBA API Loop Query Return results in excel||4||60|
|Outlook Macro to delete emails not meeting keywords||56||114|
Join the community of 500,000 technology professionals and ask your questions.