Restore network configuration from path


Please use below procedure to restore network configuration from configuration file path,

import os;
import ctypes

class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:

with disable_file_system_redirection():
    out=os.popen('netsh exec C:\Users\Prime\Downloads\Documents\mycfg.dat').read();

Sample output:

Reseting Global, OK!

Reseting Interface, OK!

Restart the computer to complete this action.

There’s no user specified settings to be reset.

The following command was not found: reset.

Reset of all TCP parameters OK!

The following command was not found: reset.