Knowledge Base

Enter search queries below or use the tag links to the right to browse the knowledge base by category (Show All Tags).


How to remove a banned IP address from Robo-FTP Server

The following PowerShell script will remove the specified IP address from the Robo-FTP Server restrictedhosts list. This list is used to implement either a blacklist or whitelist. The value of RestrictHostsBehavior is used to determine which is in effect. See https://kb.robo-ftp.com/kb/show/401 for checking the status of that value.

# Example usage:
#   remove_ip_from_restricted_hosts_list.ps1 "192.168.1.1"

$gconfig = New-Object -COMObject "RoboFTPServer.RSGlobalConfig"
$ipAddress = $args[0]
$removedSuccessfully = $false
foreach ($server in $gconfig.Servers) {
    $idx = 0
    $foundIdx = -1
    foreach ($h in $server.RestrictedHosts) {
        if ($h -eq $ipAddress) {
            $foundIdx = $idx
            break
        }
        $idx++
    }
    if ($foundIdx -ne -1) {
        $server.RestrictedHosts.Remove($foundIdx)
        $removedSuccessfully = $true
    }
}

if ($removedSuccessfully) {
    echo "removed: $hostOrIp"
}

Article last updated: 2021-05-13

Tags: banned ip address addresses server whitelist blacklist powershell