Hello,
I'm currently trying to automate some things on VMs when then don't have network access through Invoke-VMScript, and I have some issues on Debian 9.
No problem with other distribs, and even no problem with debian 8, but with debian 9, I have a nice error message.
Invoke-VMScript Error occured while executing script on guest OS in VM 'dumb-rabbit_99994'. Could not locate "Powershell" script interpreter in any of the expected locations. Probably you do not have enough permissions to execute command within guest
If I activate the log at debug level in vmtools, no entry when I try to use invoke script.
If I look at /var/messages/vmware-vmsvc.log, I see :
[Oct 17 12:44:25.606] [ message] [vix] VixTools_ProcessVixCommand: command 181
[Oct 17 12:44:25.618] [ message] [vix] VixToolsCreateTempFile: opcode 181 returning 0
[Oct 17 12:44:25.649] [ message] [vix] VixTools_ProcessVixCommand: command 185
[Oct 17 12:44:25.657] [ message] [vix] VixTools_StartProgram: opcode 185 returning 4
[Oct 17 12:44:25.688] [ message] [vix] VixTools_ProcessVixCommand: command 194
[Oct 17 12:44:25.696] [ message] [vix] VixToolsDeleteObject: opcode 194 returning 0
Tested on vSphere 6 (vCenter build 5318200, ESXi build 5572656, VMTools 10.1.5 build 5055683 and also lastest open-vm-tools coming with the distrib)
Am I missing something on the server or is Invoke-VMScript not working on Debian 9 (yet) ?
Did you use the ScriptType parameter?
The message seems to indicate that it is looking for PowerShell, on a Linux box, unless you have PowerShell Core, you should use -ScriptType bash.
Can you perhaps share the line where you call Invoke-VMScript?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you use the ScriptType parameter?
The message seems to indicate that it is looking for PowerShell, on a Linux box, unless you have PowerShell Core, you should use -ScriptType bash.
Can you perhaps share the line where you call Invoke-VMScript?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hello,
Thank you, with -scripttype bash, this is working fine.
(Line : Invoke-VMScript -ScriptText $Script -VM $VM -GuestCredential $GuestCredentials -scriptType bash)
I didn't think about it because without this option, this was working fine for other distribs.
Thanks a lot.
It helped me a lot.