06-23-2020 04:39 AM
The VPN we're using does not use DHCP, rather it hands out an IP address from a pool, and assigns it a bulk host name. This bulk host name differs from the actual host name on the client. As such, this leads to some confusion, as the user PC has multiple unrelated names.
The VPN allows the running of a script when the client connects and dicconnects. What I'd like to do is add a host record using the local cient name when the device connects and then delete the host record when the device disconnects.
We're using a combination of Windows, Macs, and Linux clients, so I need a solution that works for each case. I don't want to have to modify each client device any more than I have to. In Windows, we would run a .BAT or CMD file, using the IP address issued by the VPN and the local host name. I'm not sure how it would work on a Mac or Linux device, but I'm guessing I could extract the data needed to create a host record.
Obviously PowerShell is a prime candidate for the Windows clients, but what should I use for Macs and Linux? I'm not really a PowerShell power user, and I haven't really found a primer type document to get me up to speed with using PowerShell with the WAPI. DOes anybody have something like this?
I could easily write something in Python to add a host record, and the act of deleting the record would be much easier if I don't have to keep track of the ref. Is that even possible?