Worklet for Hosts File

Hi all,

Has anyone used Automox to update or push out a hosts file?

Thank you,
Chris.

Haven’t done that before, but I have done that using a logon script. Wait, are you very sure you want to go down this path?

1 Like

We do have some worklets to put files in a directory, so you could make use of one of those but I second @jesumyip in asking if you really want to be tinkering with hosts files :slight_smile:

Absolutely.

I want to be able to update a hosts file on a remote endpoint, using the fastest methodology I have, which is Automox.

The challenge I have, is DNS. (Isn’t it always.)
We use Cisco Umbrella, which has some oddities when it comes to Trusted Forests.
In order to (in the short term) reduce the visible impact to a small selection of internal customers, I need to set DNS entries, locally, which the most easiest and consistent way is using the hosts file.

It’s not difficult. If you are overwriting your HOSTS file, just upload a copy of it to your worklet then reference it in the powershell by name and use the file copy cmdlet. For example:

Move-Item “mynewhostsfile.txt” C:\Windows\System32\Drivers\etc\hosts -Force -ErrorAction SilentlyContinue

This is assuming you uploaded your host file as “mynewhostsfile.txt”.

The worklet posted by @Nic is a good place to start.

Could you not create a secondary DNS zone or DNS server and put those entries there instead? Just exploring ideas.

1 Like