I have a powershell script that simply updates a file on a couple different webservers. Each of these web servers have different local credentials that I need to provide in order to access the file in question. How can I update my script to allow for this?
#message
$statusMessage = "hello world"
#servers to update
$servers = @("1.1.1.1","2.2.2.2")
#update files
foreach ($server in $servers) {
Set-Content -Path "\\$server\c$\blah\foo.htm" -Value $statusMessage
}
Again, each server has it's own local Admin credentials that I need to use.