FritzBox Config Export: cURL to Invoke-Webrequest

205 views Asked by At

I want to export the config from my Fritz!Box but couldn't find any PowerShell script for that. So I'm trying to convert the curl statement I've found but it doesn't work:

curl -s -k -o $OUT --form sid=$SID --form ImportExportPassword=$Passwort--form ConfigExport= https://fritz.box/cgi-bin/firmwarecfg

I've tried many things like:

$body = {
        sid = $SID, 
        ImportExportPassword = $Passwort,
        ConfigExport = ""
}
Invoke-WebRequest -Uri "http://$FritzBoxUrl/cgi-bin/firmwarecfg" -Body $body -Method Post -OutFile $BackupPath

Info: The SID is already caught from another Invoke-Webrequest command

Also I put the parameters in the body into double quotes but that didn't work either.

I'm using PS 5.1 (integrated in Windows) which doesn't have the "-Form" Parameter.

What is the correct syntax to get it to work?

0

There are 0 answers