VMware Cloud Community
uday1kiran
Contributor
Contributor

PowerCLI not launching UI apps

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.

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

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.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
uday1kiran
Contributor
Contributor

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.

Reply
0 Kudos
LucD
Leadership
Leadership

Feel free to launch a PowerCLI Idea.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
DCasota
Expert
Expert

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

Reply
0 Kudos