Automation

 View Only
  • 1.  PowerCLI not launching UI apps

    Posted Dec 17, 2019 03:06 PM

    WHen I launch any exe/any exeutable using powercli on guest VM using powercli command.

    Invoke-VMScript, I am able to run them in the background but not in the foreground.

    i.e., UI apps are not launching but showing the background as running in the task manager.

    We need our UI Automation scripts to execute in the VM, but it is not working.

    We are able to do in virtualbox and hyper-v but not in vmware esx using powercli.

    Please suggest.



  • 2.  RE: PowerCLI not launching UI apps

    Posted Dec 17, 2019 04:21 PM

    Invoke-VMScript starts an exe under vmtoolsd.exe with a cmd command.

    That is a CUI, not a GUI.
    So no GUI to the exe that was started this way.

    As an alternative, you can create a Scheduled Task, that runs the exe, to start immediately.

    If you are logged on with the same credentials as the scheduled task is using, you should have access to the GUI of the exe.



  • 3.  RE: PowerCLI not launching UI apps

    Posted Dec 17, 2019 05:10 PM

    Thank you.

    even virtualbox starts using cmd.exe only but it will set either foreground or background hidden mode.

    And same case with VMware workstation, where we can launch exe files in foreground.

    But with esx they have only hidden mode.

    They should consider this option for esx also as they have this option with workstation.



  • 4.  RE: PowerCLI not launching UI apps

    Posted Dec 17, 2019 05:26 PM

    Feel free to launch a PowerCLI Idea.



  • 5.  RE: PowerCLI not launching UI apps

    Posted Dec 17, 2019 07:34 PM

    On the solution path using ms windows scheduler, you could use the ms windows schtasks command to execute a temporary ps script.

    Powershell and schtasks as well, both have parameters for "interactive" in the meaning of what do show up in case the loggedon username matches with the run as user option set.

    Be aware, a managed solution path with windows scheduler dependency is rather dificult.

    $ScriptFile = "Yourfullpathandrandomfilename.ps1"

    $lines = ''

    $lines += '$CodeBlock=@'+"'`r`n"

    $lines += "insert enc64 content here"+"`r`n"

    $lines += "'" + '@'+"`r`n"

    set-content -path $ScriptFile -value $lines -encoding ASCII

    $hzpassword="password"

    $hzuser="username"

    $begintime="00:00"

    $TaskName="Your random task name"

    $PowershellFilePath="$PsHome\powershell.exe"

    $Argument = "\"""+$PowershellFilePath +"\"" -WindowStyle Normal -NoLogo -NoProfile -Executionpolicy unrestricted -command \"""+$ScriptFile+"\"""

    echo ${hzpassword} | schtasks.exe /create /f /tn "$Taskname" /tr $Argument /SC ONCE /SD "12/17/2019" /ST $begintime /RU ${hzuser} /RL HIGHEST

    schtasks /Run /TN "$Taskname" /I