Search code examples
powershellremote-desktoppowercliesxivmware-workstation

Powercli issue to launch internet explorer in remote machine


I am trying to launch internet explorer and pass the url in remote machine using a bat file. I am using powercli to execute the bat script.

Problem: When I tried to launch calculator, it launches successfully but when I tried to launch internet explorer, it runs but in background. So, basically I wanted to launch IE in foreground so, I can see and perform actions.

Using command to execute bat file: Invoke-VMScript -VM 'machine_name' -ScriptType bat -ScriptText 'C:\Users\jeet\Desktop\launchBrowser.bat' -GuestUser user -GuestPassword password

Content of bat file which is present in desktop: C:\Program Files\Internet Explorer\iexplore

Note: Command runs successfully without showing any error


Solution

  • problem solved by schtasks for scheduling ask

    Invoke-VMScript -vm windows10 -guestUser shibu -guestPassword password -ScriptText 
    'schtasks /create /tn task100 /f /tr \"C:/Users/shibu/Desktop/launchBrowser.bat 
    file://C:/Windows/System32/calc.exe\" /sc weekly'
    
    Invoke-VMScript -vm windows10 -guestUser shibu -guestPassword password -ScriptText 
    'schtasks /run /tn task100'