I used the following code a while back as part of a solution to automate the banning of spammers via their IP address.
'Here, we will pretend this is an imported list
XMLarr(0) = "22.214.171.124"
XMLarr(1) = "126.96.36.199"
Set objIIS = GetObject("IIS://localhost/w3svc") 'careful, this sets IPDENY on every child web
Set IISipsec = objIIS.IPSecurity
If (IISipsec.GrantByDefault = True) Then
arrIP = IISipsec.IPDeny
arrIPSize = ubound(arrIP)
For i = 0 to arrIPSize
arrIPstring = arrIPstring & "," & arrIP(i) 'going to use for dupes later.
ReDim preserve arrIP(arrIPSize + UBound(XMLarr)+1)
for i = 0 to UBound(XMLarr)
myNum = arrIPSize + i+1
If InStr(arrIPstring,XMLarr(i)) = 0 Then
arrIP(myNum) = XMLarr(i)
IISipsec.IPDeny = arrIP
objIIS.IPSecurity = IISipsec
Set IISipsec = nothing
Set objIIS = nothing