简体   繁体   中英

VMWare PowerCLI Invoke-VMScript

I would like to Invoke a command on a Remote VM using PowerShell with PowerCLI.

Invoke-VMScript -ScriptText "cmd /c calc" -ScriptType Bat -VM $VMName -GuestCredential $Credential -Confirm:$false -ea SilentlyContinue

Sadly everytime when my command get's invoked an Popup appears telling me "A Program running on this computer is trying to display a message" If click manually on that Popup my Script runs fine, but how can I automate this, so that I can use PowerCLI for this.

The goal is to execute a Binary in Interactive Mode, that processes Automated Tasks, when the Script get's invoked by "Invoke-VMScript"

This is an issue with Interactive Services Detection . Your script is trying to run as interactive in Session 0.

The standard workarounds are creating a schedule task and then triggering it. Or invoking psexec.exe to the user session with -i .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM