VBScript to Power shell

by Aug 9, 2013

Not sure how to translate this vbscript into a working Power Shell script. 

rules = oSite.GetIPAccessRules()

For Each key In rules

If key.type = 0 Then

WScript.echo "AutoBan"

autoban = key.BannedIPs

For Each key2 In autoban

WScript.echo "Address " & CStr(key2.address)

WScript.echo "Banned " & CStr(key2.banned)

WScript.echo "Permanently " & CStr(key2.permanently)

WScript.echo "Expires " & CStr(key2.expires)

WScript.echo "Reason " & CStr(key2.reason)


End if


I have the variables decleared in my PS1 script as follows:

$autoban = {Key.BannedIPs}








= {key2.address}




= {key2.banned}




= {key2.permanetly}

$Expires = {key2.expires}




= {key2.reason}

But when I try to use the COMAPI libary to getIPAccessRules I get an error retrieving the COM Class factory componenet with CLSID all zeros Failed du to the following error: 80040154 Class not registered