vmconnect.exe running in background service when we run with ansible

Hi All,

Need your guidance on vmconnect.exe on ansible.

I am trying to connect to new Virtual machine using vmconnect.exe in ansible with below playbook but it is running as service. Can you please help how can i run as foreground in windows.

This works fine when we run same command on powershell to connect VM.

  • name: connect to VM
    win_shell: vmconnect.exe localhost demomachine

also tried win_scheduler_task to connect but this also runs in background.

  • name: Connect to VM
    win_scheduled_task:
    name: Interactive Process
    actions:
  • path: vmconnect.exe localhost demomachine
    logon_type: interactive_token
    username: ansible

Thanks
Raviteja