I am trying it with a bat file and still dont work. but if I run the bat file manually on the machine it works any idea?
$vms = get-vm -name (get-content vms.txt)
$source = "\\server\share\vmtools\windows"
$bat = {start-process -filepath "c:\temp\windows\install.bat"}
foreach ($vm in $vms){
$destination = "\\$vm\c$\temp"
copy-item -recurse -filter *.* -path $source -destination $destination -force
invoke-command -computername $vm -scriptblock $bat
}
install.bat is just
c:\temp\windows\setup64.exe /S /v "/qn REBOOT=R ADDLOCAL=ALL"