Closed rahul14sep closed 3 years ago
Howdy 🖐 rahul14sep ! Thank you for your interest in this project. We value your feedback and will respond soon.
If you want to contribute to this project, please make yourself familiar with the CONTRIBUTION
guidelines.
What does the following report for your vm?
% govc object.collect vm/VC-ATM-ICLONE guest.guestFamily
The govc code uses cmd.exe when windowsGuest
, otherwise bash: https://github.com/vmware/govmomi/blob/13851af3d26288ec5760970b5b3ae3fd298d014d/guest/toolbox/client.go#L120-L133
govc object.collect vm/VC-ATM-ICLONE guest
Output:
guest.toolsStatus types.VirtualMachineToolsStatus toolsOk
guest.toolsVersionStatus string guestToolsCurrent
guest.toolsVersionStatus2 string guestToolsSupportedNew
guest.toolsRunningStatus string guestToolsRunning
guest.toolsVersion string 11269
guest.toolsInstallType string guestToolsTypeMSI
guest.guestId string
guest.guestFamily string otherGuestFamily
guest.guestFullName string Windows Server 2019, 64-bit (Build 17763)
Its not populating correct information for guest family because we are using ESX 6.7 which does not support win2k19 OS.
For such cases can we have optional parameter in guest.run to override shell path , where we could specify which shell to use (shell="c:\Windows\System32\cmd.exe" or shell="/bin/bash") something like that .
Like we have option in pyvmomi ps = vim.vm.guest.ProcessManager.ProgramSpec(programPath=r'C:\Windows\System32\cmd.exe', arguments='/c powershell C:\windows_network_refresh.ps1')
Ah ok. With #2451 you can use the same ProgramSpec in your example or the new guest.run -w
flag to set guestFamily to Windows, which makes cmd.exe /c
the default way to run the program
This will help. Thanks @dougm for adding this support.
@rahul14sep just note that Doug created an even better fix for this issue using auto-detection, that is not requiring any flags :)
I want to execute powershell script on window vm using govc, I tried using
govc guest.run
but it looks to execute file in /bin/bash shell, Is there any way i could tell govc to use windows command prompt?Command I tried govc guest.run -vm VC-ATM-ICLONE -l='username:password' 'powershell C:\windows_network_refresh.ps1'
and got below error govc: ServerFaultCode: File /bin/bash was not found
Is there any other way I could execute file on windows vm.