Create Quickbooks Server Firewall Rules

Modified on Fri, 16 Oct at 2:12 PM

Run in admin PowerShell:


# Requires -RunAsAdministrator

$exeFiles = @(
    "QBW32.exe",
    "QBDBMgrN.exe",
    "DBManagerExe.exe",
    "filemanagement.exe",
    "QBCFMonitorService.exe"
)

# 4 search paths covering 64-bit and 32-bit Program Files & Common Files
$searchPaths = @(
    "C:\Program Files\Intuit",
    "C:\Program Files (x86)\Intuit",
    "C:\Program Files\Common Files\Intuit",
    "C:\Program Files (x86)\Common Files\Intuit"
)

# Filter down to paths that actually exist on this system
$validPaths = $searchPaths | Where-Object { Test-Path $_ }

if (-not $validPaths) {
    Write-Error "None of the specified Intuit directories exist on this system."
    exit
}

# Collect all matching unique file paths across all roots
$discoveredFiles = @{}

foreach ($path in $validPaths) {
    Write-Host "Searching in: $path" -ForegroundColor Cyan

    foreach ($exeName in $exeFiles) {
        $found = Get-ChildItem -Path $path -Recurse -Filter $exeName -File -ErrorAction SilentlyContinue

        foreach ($file in $found) {
            # Use lowercase full path as key to prevent duplicate rules across overlaps
            $discoveredFiles[$file.FullName.ToLower()] = $file
        }
    }
}

if ($discoveredFiles.Count -eq 0) {
    Write-Warning "No matching QuickBooks executables were found in any search path."
    exit
}

# Create or verify firewall rules
foreach ($file in $discoveredFiles.Values) {

    $exeName = $file.Name
    $folderName = $file.Directory.Name
    $ruleName = "QuickBooks $exeName"

    # Match by DisplayName or Program path to prevent duplicates
    $existingRule = Get-NetFirewallRule -DisplayName $ruleName -ErrorAction SilentlyContinue

    if (-not $existingRule) {

        # Check if an active rule already points to this exact executable path
        $existingAppRule = Get-NetFirewallApplicationFilter -Program $file.FullName -ErrorAction SilentlyContinue |
            Get-NetFirewallRule -ErrorAction SilentlyContinue |
            Where-Object {
                $_.Direction -eq "Inbound" -and
                $_.Action -eq "Allow"
            }

        if ($existingAppRule) {
            Write-Host "Rule already exists for program path: $($file.FullName) ($($existingAppRule.DisplayName))" -ForegroundColor Yellow
            continue
        }

        New-NetFirewallRule `
            -DisplayName $ruleName `
            -Description "QuickBooks inbound traffic for multi-user hosting ($($file.FullName))" `
            -Direction Inbound `
            -Program $file.FullName `
            -Action Allow `
            -Profile Any `
            -Enabled True `
            -Protocol Any

        Write-Host "Firewall rule created: $ruleName -> $($file.FullName)" -ForegroundColor Green
    }
    else {
        Write-Host "Rule already exists: $ruleName" -ForegroundColor Yellow
    }
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article