Even though one of my old engineer friends, Greg, would be saying to me all the time, “why the hell are you still messing around with VBScript when you should be doing that in Powershell”.
I say if you can do it in any language or framework, why not know how. Especially, when there are so many repositories of great vbscripts out there for the Windows OS. If there is a way to do something, I’ll try it and then just to put that code in my library for some rainy day or integrate it in to something I’ve already written to improve it.
Run this VBSCript if you want to get a list of the IP restrictions that have been set on a Windows Server running Microsoft’s IIS .
This code will pop-up a message box as it iterates through a list of the server’s IP restrictions which can be set on a collection of objects. It can go on forever.
Sample Code
You can get a copy of this VBScript from my GitHub Repo.
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
& strComputer & "\root\microsoftiisv2")
Set colItems = objWMIService.ExecQuery _
("Select * from IIsIPSecuritySetting")
For Each objItem in colItems
Wscript.Echo "Name: " & objItem.Name
For Each strDeny in objItem.DomainDeny
Wscript.Echo "Domain Deny: " & strDeny
Next
For Each strGrant in objItem.DomainGrant
Wscript.Echo "Domain Grant: " & strGrant
Next
Wscript.Echo "Grant By Default: " & objItem.GrantByDefault
For Each strDeny in objItem.IPDeny
Wscript.Echo "IP Deny: " & strDeny
Next
For Each strGrant in objItem.IPGrant
Wscript.Echo "IP Grant: " & strGrant
Next
Next
As always, I like to share and give credit to the online resources where I find these gems.
CRUTO.com
VBSEdit.com