We have a partner site that must be accessible only if we add the entry for it in the host files of the computers we need to access it.
How can we update the host files or the workstations via powershell remotely ?
I was thinking of doing this in 2 steps: remote renaming the old host file and copying the new one to the destination stations.
Domain credentials will be used for this purpose.
I know how to parse the correct credentials, I just need some insight on how to rename the destination host and copy the new one from the a local server to the destinations. It does not have to be a mass-copy, deployment for each station would suffice.
Alternately, is there a way to directly alter the destination host file, give that it has additional protection from the OS ?
I think the meat of your question is how to you copy the modified file to the remote machine. This can be accomplished over a powershell session, without any other firewall rules of file sharing.
A more elegent solution is to use the hostsFile module with the
Add-HostEntry
command.