How to Restart a Fritz!Box Modem/Router over the Internet from a C# Console Application

In this tutorial, we are going to develop a small C# Console application that will be able to restart a FritzBox modem/router over the Internet. For that, we will use the PS.FritzBox.API library.

First, we need to configure a user on the FritzBox that will have the right to access it over the Internet.

  • Login into the web interface of the FritzBox
  • In the Navigation Panel select System -> Fritz!Box Users
  • On the User panel, click the Add user button
  • Enter a Username, a Password, and check the box Access from Internet
  • Click OK at the bottom of the page to save the entries

In the next step, create a new C# Console application and add the PS.FritzBox.API library

  • Start Visual Studio IDE (I used the Visual Studio 2017)
  • Select File -> New -> Project…
  • In the New Project window select Installed -> Visual C# -> Windows Desktop -> Console App (.NET Framework)
  • Enter RebootFritzbox as the Project name
  • Enter FritzboxUtilities as the Solution name
  • Click OK to create the project
  • In the Solution Explorer, right-click on the project name and select Manage NuGet Packages
  • In the opened window, activate the Browse panel and enter PS.FritzBox.API in the search field
  • Click on the appeared library name and select the Version 1.0.0 (Note, there are also version 1.2.0 and 1.2.1 in the NuGet repository. Yet these versions did not work for me)
  • Click Install to install the package and confirm the changes if needed in the Preview Changes window

Finally, replace the content of the file Program.cs with the following content and replace the placeholders with the proper data :

using PS.FritzBox.API;

namespace RebootFritzbox
    class Program
        static void Main(string[] args)
            DeviceConfigClient client = new DeviceConfigClient("", 10000);
            client.UserName = "FritzBoxUser";
            client.Password = "FritzBoxPassword";

Now, if you execute the application the Fritz!Box router will restart. The library contains many other functions that can be helpful, if you want to automate your work.