I am getting the following error :
This command cannot be run due to the error: The system cannot find the file specified. + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOperationException + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand + PSComputerName : XXXXXX.yyy.com
Here is the snippet of the code:
if (($ToolsStatus -eq 'toolsOk' -OR $ToolsStatus -eq 'toolsOld') -AND $VMVSSStatus -eq $null -AND $OperatingSystem -match "64-bit" ) {
try{
Copy-Item -Path ".\64bit\$ToolsVersion.exe" -Destination "\\$FQDN\c$\" -Container -Recurse -Force -ErrorAction Stop
"File $ToolsVersion.exe copied on $vmName" | Do-Log
try {
Invoke-Command -ComputerName $FQDN -ScriptBlock {
Start-Process "C:\$ToolsVersion.exe" -ArgumentList '/s /v "/qn reboot=r ADDLOCAL=all"' -Wait
Start-Process "C:\$ToolsVersion.exe" -ArgumentList '/s /v "/qn reboot=r REMOVE=VSS"' -Wait
Start-Process "C:\$ToolsVersion.exe" -ArgumentList '/s /v "/qn reboot=r ADDLOCAL=VSS"' -Wait
"Installation completed on $vmName" | Do-Log
taskkill /IM vmtoolsd.exe /F
"VMtools process killed on $vmName" | Do-Log
Start-Service -Name VMTools
"VMware Tools service was started on $vmName" | Do-Log
}
}
catch [System.Management.Automation.RuntimeException]#PSRemotingTransportException
{
"Unable to install on $vmName. Following error was encountered:" +$_.Exception.GetType().FullName | Do-Log
}
Please help.