I have the following simple script which I'm using to push some files to a number of Win7 and Server2008 machines. In most cases the local user has no password. However the scripts fails because I'm trying to write through the admin share (c$). What is the most simple way to pass a user for each host machine in the ip.txt?
Also if I'm on a domain how simple is it to modify the script to authenticate with a user and password.
Write-Host 'Deploy Tools'
$reader = [System.IO.File]::OpenText("c:\scripts\ip.txt")
try {
for(;;) {
$line = $reader.ReadLine()
if ($line -eq $null) { break }
echo "**** files being copied to: $line ****"
xcopy c:\scripts\tools \\$line\c$\windows\system32\ /Y
}
}
finally {
$reader.Close()
}