Write to a file using WAPT
Published: January 22, 2021 - 1:30 PM
Hello,
I would like to create a simple package that:
- upon installation, modifies the file C:\Windows\System32\drivers\etc\hosts
(adding IP/host resolution entries)
- upon uninstallation, restores the default (empty) Windows hosts file.
Is there a Python wpat function to write to a file?
Or should I replace the hosts file with a copy?
The purpose of this package is to provide IP/host resolution in case of DNS service failure on my network (e.g., power outage, server shutdown), a sort of fallback mode. Under normal operation, the information in the hosts file will be the default, but I will only deploy the package on a few machines that need to function without DNS.
Sincerely,
Ed
I would like to create a simple package that:
- upon installation, modifies the file C:\Windows\System32\drivers\etc\hosts
(adding IP/host resolution entries)
- upon uninstallation, restores the default (empty) Windows hosts file.
Is there a Python wpat function to write to a file?
Or should I replace the hosts file with a copy?
The purpose of this package is to provide IP/host resolution in case of DNS service failure on my network (e.g., power outage, server shutdown), a sort of fallback mode. Under normal operation, the information in the hosts file will be the default, but I will only deploy the package on a few machines that need to function without DNS.
Sincerely,
Ed