Last active
July 10, 2019 05:55
-
-
Save junecastillote/3a4bc3c1b5a00f0dc103ada2cf2c8807 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
How to use: | |
1. Copy / Save the code as ExportIISAllowedRelayIP.vbs | |
2. Open Command Prompt. | |
3. Change directory to where the sript is saved. | |
4. Run this command: | |
cscript //nologo ExportIISAllowedRelayIP.vbs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' Output file for report | |
fileOutput = "Allow_RelayIP.txt" | |
' The Vitual SMTP Server ID | |
vistualSMTPServer = "IIS://localhost/smtpsvc/1" | |
Set fso = CreateObject("Scripting.FileSystemObject") | |
Set allowFile = fso.opentextfile(fileOutput,2,true) | |
Set objSMTP = GetObject(vistualSMTPServer) | |
Set objRelayIpList = objSMTP.Get("RelayIpList") | |
objCurrentList = objRelayIpList.IPGrant | |
i = 0 | |
For Each objIP in objCurrentList | |
arrayFields = Split(objIP, ", ") | |
allowFile.WriteLine arrayFields(0) | |
Wscript.Echo arrayFields(0) | |
i = i + 1 | |
Next | |
Wscript.Echo "Saved in " & fileOutput | |
If i = 0 Then | |
Wscript.Echo "No entries found" | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment