VMware Cloud Community
gaofei2018
Contributor
Contributor
Jump to solution

powerCL是否可以向安装了Tools的虚拟机中推送文件或者脚本并执行。

我们可以使用通过vRealize Orchestrator安装的工具将脚本或文件命令推送到虚拟机。powershell是否也能做到这一点。

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

If the VMware Tools are installed you can use the Invoke-VMScript and Copy-VMGuestFile cmdlets.


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

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

If the VMware Tools are installed you can use the Invoke-VMScript and Copy-VMGuestFile cmdlets.


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

0 Kudos
gaofei2018
Contributor
Contributor
Jump to solution

谢谢!,这个是可以的,但是我发现他只能进行单行命令。如果需要多行,怎么处理。

例如同时推送下面两行命令,需要如何书写。

xcopy \\192.168.8.125\public\download\LAPS.x64.msi C:\ttyy\ /S /E /Y

 start /i C:\ttyy\LAPS.x64.msi /passive /quiet

0 Kudos
LucD
Leadership
Leadership
Jump to solution

If the target Guest OS is a Linux based OS, you can use the semi-column (;) to pass multiple commands in one line.

Or you can try my Invoke-VMScriptPlus function, which adds a multi-line option for Linux Guest OS.


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

0 Kudos