Hi all,
Environment:
vSphere Client Version 6.5.0.13000
Windows 10 64-bit 1703 Virtual Machines
4 ESXi Host(s):
3 are 5.5.0, 6480324,
1 is 5.5.0, 7967571
Problem:
I am trying to use Invoke-VMScript off a a Windows Server 2012 R2 Monitoring Server to send a script to various VMs. I am getting an error message:
I have opened up port 902 on all of the Virtual Machines but I am still receiving this message and I am not sure what is wrong now as the account I am using has Administrative access to do anything on the VMs, as well as the correct rights in vSphere.
From the error message I would think that there 2 possible causes:
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
I have tried the PowerShell Script manually on the device and it works without any issues.
I only have issues when trying to do anything remotely, either with crating a PSSession, Invoke-Command, or Invoke-VMScript. (I know that the first two require different ports, but I wanted to point out the similarity.
Do you have any other ideas on what could be blocking the device? Also do you know where I would need to have ports open, and which ports I would need to have open? (Do I need to open more than port 902, and do I need to have it open on the Monitor Server as well as the VMs?)
No, that port should be sufficient.
But it doesn't look like a port issue, rather something inside the guest OS and/or the VMware Tools.
Is there anything in the vmware.log for that VM?
What do you mean with the "Monitor Server"?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have a "Monitor Server" that I am running all of my automation scripts from, which is not the vCenter host server so I am using PowerCLI to run the commands remotely.
I am able to run most of the PowerCLI commands, including creating new VMs. I only seem to have an issue connecting with the Guest OS because I couldn't get my OS Cus Specs to work either.
Where is the vmware.log located on the VM?
In the same folder where the VM's VMX file is located.
In there should be all interactions through the VMware Tools
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am newish to vmware logging and I don't know where those are located specifically. I found these though:
Which one should I be looking at, and is there something I should be looking for?
Also, I tried adding the computer to the domain to see if that would change anything and there was no difference.
I ran the command and then noticed that these 4 lines were added to the "vmware-vmsvc.log" file:
I am not really sure what they mean though.
You should be looking in the datastore where the VM is living.
You can find the path of the VMX file by doing
Get-VM | Select Name,@{N='VMX';E={$_.ExtensionData.Config.Files.VmPathName}}
In the Web Client, select the Storage tab, then find the datastore mentioned in the VMX property (see above).
Select that datastore, and click the Files tab.
Now find the VM's folder, select the vmware.log file in that folder and click Download.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I was able to find the log, but there were no logs created around the time that I "created" the issue. Any other ideas on what might be occurring?
I do see that temporary files were created/deleted at the time in which I sent the invoke-vmscript
Can you try to capture a transcript?
Use the code like this (update the password)
$code = @'
Start-Transcript -Path "$env:windir\Temp\log.txt"
Get-ChildItem
Stop-Transcript
'@
Invoke-VMScript -VM $virtualMachine -ScriptText $code -ScriptType Powershell -GuestUser Administrator -GuestPassword 'Your-admin-Password'
On the VM now check if there is a C:\Windows\Temp\log.txt file, and check what is in there.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I ran the command, which resulted in the same error.
I then checked the machine and a log.txt did not exist in the directory referenced.
I also checked the Events of the VM, and again a file was created then deleted at runtime.
Thank you for continuing to help, I have checked with other parts of our company and this issue seems to be common across multiple departments and nobody has a fix for it, not to say there isn't one but it sounds like there is little hope.
You could try to get more info in the vmware.log file by enabling the debug option for VMware Tools.
See KB1007873
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference