Have the below script which is to execute a .exe, but running into error ,
"Cannot Validate Argument On Parameter 'ComputerName'
What am I missing here?
Start-Transcript -path C:\temp\Connect.txt -Append
$servernames = get-content C:\Temp\Servers.txt
foreach ($servername in $servernames)
{
$servername
$remotesession = New-PSSession -ComputerName $servername
Invoke-Command -Session $remotesession -ScriptBlock { Start-Process -FilePath 'C:\Program Files (x86)\Enterprise\Client\client.exe' }
Write-Host "client invoked"
}
Remove-PSSession -Session $remotesession
Stop-Transcript