I wrote a script to execute an exe on list of remote servers, but script is running. but I can't see the exe executing on remote machines.
can anyone help me to correct below script.
ForEach ($Computer in Get-Content C:\server.txt)
{
echo "$Computer"
$command = "c:\windows\WUInstall.exe /install /reboot"
Invoke-Command -ComputerName $Computer -ScriptBlock {$command}
}