VMware Cloud Community
dwchan
Enthusiast
Enthusiast
Jump to solution

Benign error when executing Copy-VMGuestFile

I am trying to track this benign error I keep getting when I invoke the 'Copy-VMGuestFile' commandlet/  The code is simple

If ($strVMRole -ne 'Standard') {
My-Logger "Copy role configuration files to Virtual Machine '$strVMName' ..."
Copy-VMGuestFile -Source "$PostIntallationRepo\$strVMPrepDir\*" -Destination "C:\$strVMPrepDir\" -VM $strVMName -LocalToGuest -GuestCredential $DCLocalCredential -Force
}

It just copies a folder/files from my PC to a VM.  I am using the local administrator credential versus the domain version of an administrator.  I double-check all the variables to ensure they are defined and valid.  In a matter of fact, from when I can tell, all the folder/files that need to be on VM were successfully copied over.  However, I keep getting this error, (see below) makes no sense as the template I used for the VM are recent, and it is using the latest VMtools etc.

[01-10-2021_01:43:06] Copy role configuration files to Virtual Machine 'SCA1' ...
WARNING: The guest OS for the virtual machine 'SCA1' is unknown. The operation may fail.
Copy-VMGuestFile : 1/10/2021 1:46:32 AM Copy-VMGuestFile A general system error occurred: vix error codes = (3016, 0).

At D:\VMware\WindowsVM 6.ps1:391 char:5
+ Copy-VMGuestFile -Source "$PostIntallationRepo\$strVMPrepDir\*" - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Copy-VMGuestFile], SystemError
+ FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DirectoryExistsInGuest_ViError,VMware.VimAutomation.ViCore.Cmdle
ts.Commands.CopyVMGuestFile

WARNING: The guest OS for the virtual machine 'SCA1' is unknown. The operation may fail. 

Not a clue as to what "The Guest OS for the VM is unknown, as I see it from vCenter dashboard.  And what is causing this vix error code?  Or perhaps which / where the log on the VM I can get more info .  Thank you and any feedback would be appreciated 

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

That is the correct source for the value, but that list changes with the vSphere version.
You can check what GuestId are supported for a VM by doing

$vmName = 'MyVM'

$vm = Get-VM -Name $vmName
$envBrowser = Get-View -Id (Get-View -Id (Get-View -Id $vm.ExtensionData.Runtime.Host).Parent).EnvironmentBrowser
$hwVer = $envBrowser.QueryConfigOptionDescriptor().where{$_.DefaultConfigOption}.Key
($envBrowser.QueryConfigOption($hwVer,$vm.ExtensionData.Runtime.Host)).GuestOSDescriptor |
Select Id,FullName

 If you are running on a vSphere version that has builtin support for Windows 2016 you should the entry with

$vmName = 'MyVM'

$vm = Get-VM -Name $vmName
$envBrowser = Get-View -Id (Get-View -Id (Get-View -Id $vm.ExtensionData.Runtime.Host).Parent).EnvironmentBrowser
$hwVer = $envBrowser.QueryConfigOptionDescriptor().where{$_.DefaultConfigOption}.Key
($envBrowser.QueryConfigOption($hwVer,$vm.ExtensionData.Runtime.Host)).GuestOSDescriptor |
Where{$_.FullName -match '2016'} |
Select Id,FullName

 


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

View solution in original post

6 Replies
LucD
Leadership
Leadership
Jump to solution

This is a warning and you can (in most cases) safely ignore it.
Which OS did you specify when you created the VM?
That is the GuestId parameter on the New-VM cmdlet.


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

Reply
0 Kudos
dwchan
Enthusiast
Enthusiast
Jump to solution

The OS on my template is Windows 2016.  I will give the GuestID a try, however, doesn't the OSCustomizationSpec file (which I am using) already contain that info?

Also, where can I go to get a list of possible valid GuestID values to use?  As I am using various within my environment (e.g. Win2016/2019/7/10 and couple linux)

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

No, the OSCustomizationSpec is for the Guest OS.
The GuestId is what vSphere knows about the type of OS running on the VM


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

Reply
0 Kudos
dwchan
Enthusiast
Enthusiast
Jump to solution

Nice, minor details but I see your point.  Where is a good place to get the most up to date value one can use for GuestID?  This is what I find, but not sure if this would be the best resource.  Also, I do not see Windows 2016 as an option

https://vdc-repo.vmware.com/vmwb-repository/dcr-public/6b586ed2-655c-49d9-9029-bc416323cb22/fa0b429a...

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

That is the correct source for the value, but that list changes with the vSphere version.
You can check what GuestId are supported for a VM by doing

$vmName = 'MyVM'

$vm = Get-VM -Name $vmName
$envBrowser = Get-View -Id (Get-View -Id (Get-View -Id $vm.ExtensionData.Runtime.Host).Parent).EnvironmentBrowser
$hwVer = $envBrowser.QueryConfigOptionDescriptor().where{$_.DefaultConfigOption}.Key
($envBrowser.QueryConfigOption($hwVer,$vm.ExtensionData.Runtime.Host)).GuestOSDescriptor |
Select Id,FullName

 If you are running on a vSphere version that has builtin support for Windows 2016 you should the entry with

$vmName = 'MyVM'

$vm = Get-VM -Name $vmName
$envBrowser = Get-View -Id (Get-View -Id (Get-View -Id $vm.ExtensionData.Runtime.Host).Parent).EnvironmentBrowser
$hwVer = $envBrowser.QueryConfigOptionDescriptor().where{$_.DefaultConfigOption}.Key
($envBrowser.QueryConfigOption($hwVer,$vm.ExtensionData.Runtime.Host)).GuestOSDescriptor |
Where{$_.FullName -match '2016'} |
Select Id,FullName

 


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

dwchan
Enthusiast
Enthusiast
Jump to solution

Thank you, killed two birds with one stone 😉  Got the master list of GuestID I was looking for.  Let me give this a try, adding in GuestID, and see if the error goes away.  I have to say, it is not consistent, as sometimes I do not get it, which makes no sense.  I will play around between Local and Domain credentials to see if there is a difference in behavior.  But in any case, the message it pops up still annoy as I thought it was an error versus a warning

 

Reply
0 Kudos