Invoke-command works only when any user is logged (msi install)

48 Views Asked by At

I've got a problem with running Invoke-Command on remote Computer with WinRM up and running. I've configured and run WinRM, but Invoke-Command with task of Silent Install is not successfully run until I've run it when any User is logged in on remote PC. So without active users session the task simply hangs and nothing happened, but with User session everything works as expected. I've checked everything inside Script Block and it's correct. I've tried to run task with adding User to Local Administrator Group and as Domain Admin, the same... Any suggestions? Thx

Part of my code is below:

# Create Session
        $session = New-PSSession -ComputerName $computer

        # Install the application on the remote computer
        Invoke-Command -Session $session -ScriptBlock {
            Start-Process -FilePath "c:\VMware-Horizon-Agent-x86_64-2312-8.12.0-23142606.exe" -ArgumentList "/s /v`"/qn ADDLOCAL=Core,USB,RTAV,VmwVaudio,GEOREDIR,V4V,PerfTracker,HelpDesk,PrintRedir REMOVE=ClientDriveRedirection`"" -Wait
        }

I've tried to silent install software by running Invoke Command and expected the command will run successfully

0

There are 0 best solutions below