Running 11.1 of PowerCLI
vCenter cluster is 6.5
I can create VMs with GUI without fail
I am connected to my vcenter server as evident from using $global:defaultviserver
My Get-Datastore and Get-VMHost return valid entries and the store I want to use and host I want to use
This is all you get when PowerCLI does not like your command or it fails:
New-VM : 4/24/2019 7:48:23 AM New-VM
At D:\git\moe\build\testVMCreate.ps1:14 char:1
+ New-VM -Name $targetvm1 -Datastore $datastore -VMHost $VMHost -Locati ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [New-VM], VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM
Not much to go on (hint PowerCLI developers, can we enhance this to give more feedback please?)
This is the command I am using with obvious variables
Get-Folder returns the location I have unfocused in command above
I have tried stripping out many arguments and parameters to get to basic command and nothing works.
The odd thing is the New-VM command documentation says -Template is required. Can't I simply create a new VM from raw parameters?
Creating a new template requires a VM to create it from. See the issue there? New-VM needs a template, New-Template needs a VM, according to the docs.
The New-VM cmdlet comes with multiple parametersets.
One of these creates a VM from scratch, another creates a VM from a Template.
You can't use key parameters from different parametersets mixed together.
Concerning your issue, can you provide a bit more information?
What platform? What PowerShell version?
Check with
Is your PowerCLI installation ok?
What does the exception say?
Can you run this after the error?
$error[0].Exception.InnerException
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could you be hitting this issue?
New-VM in 11.2 requires a portgroup
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
PS D:\git\moe\build> $error[0].Exception
4/24/2019 8:29:14 AM New-VM
PS D:\git\moe\build> $error[0].Exception.InnerException
Not a lot of help
Powershell is 5.1
PowerCLI is 11.1 (11.2 would not let me connect to vcenter with same exact credentials)
ModuleType Version Name
---------- ------- ----
Script 6.7.0.1... VMware.DeployAutomation
Script 6.7.0.1... VMware.ImageBuilder
Manifest 11.1.0.... VMware.PowerCLI
Script 6.7.0.1... VMware.Vim
Script 11.0.0.... VMware.VimAutomation.Cis.Core
Script 11.0.0.... VMware.VimAutomation.Cloud
Script 11.0.0.... VMware.VimAutomation.Common
Script 11.0.0.... VMware.VimAutomation.Core
Script 7.6.0.1... VMware.VimAutomation.HorizonView
Script 10.0.0.... VMware.VimAutomation.License
Script 11.0.0.... VMware.VimAutomation.Nsxt
Script 11.0.0.... VMware.VimAutomation.Sdk
Script 11.0.0.... VMware.VimAutomation.Security
Script 11.1.0.... VMware.VimAutomation.Srm
Script 11.1.0.... VMware.VimAutomation.Storage
Script 1.3.0.0 VMware.VimAutomation.StorageUtility
Script 11.0.0.... VMware.VimAutomation.Vds
Script 11.0.0.... VMware.VimAutomation.Vmc
Script 10.0.0.... VMware.VimAutomation.vROps
Script 6.5.1.7... VMware.VumAutomation
Do you see a Task or Events in the Web client?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Unfortunately not.
This is all that is in $error too
writeErrorStream PSMessageDetails Exception
---------------- ---------------- ---------
True VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.VimException.VimException: 4/24/2019 8:50:27 AM New-VM ---> VMware.Vi
m.VimException...
It is also strange that you couldn't connect when you had 11.2 installed.
That could indicate an issue on your station.
Is it possible to remove all the folders related to PowerCLI 11.0, and then try Install-Module -Name VMware.PowerCLI again?
Or perhaps try to install 11.2 on a completely different station?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Fresh install on another wkstn with install-module (11.2) results in:
Connect-VIServer : 4/24/2019 9:33:07 AM Connect-VIServer Permission to perform this operation was denied. Required privilege 'System.Read' on managed object wit
h id
'OptionManager-VpxSettings'.
When trying to connect.
11.1 does NOT do this.
That is indeed a known issue/change in 11.2.
You need at least 'System.Read' on the root of the vCenter.
If that is a problem in your environment, then you are stuck I'm afraid.
Ok, back to 11.1 then I assume?
You don't have the Hyper-V module installed in your environment by any chance?
Do a
Get-Command -Name Get-VM
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Looks like just VMware is there.
CommandType Name Version Source
----------- ---- ------- ------
Cmdlet Get-VM 11.0.0.... VMware.VimAutomation.Core
I will reach out to peers and get the system read added.
This is indeed an issue in 11.2, I would suggest to open a SR for that in any case.
And yes, PowerCLI is supported (even when GSS tells you that you need a Devloper Support Contract).
Refer to PowerCLI Support Breakdown
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I would be happy if I could just get New-VM to work on any PowerCLI release.
You could try going back further , and installing 10.2
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hilarious, 10.2 works fine.
Any idea how to specify network adapter type and SCSI controller types?
Self answered
Get-VM $targetvm1 | Get-ScsiController | Set-ScsiController -Type VirtualLsiLogicSAS -Confirm:$False
Additionally, where is windows server 2016 or 2019 in the GuestID setup?
Self answered
-GuestId 'windows9Server64Guest'
This only works for Windows Server 2016 64 bit
Wonder when 2019 will be around?
Is someone going to look at how 10.2 creates a new VM and compare it to 11.(any) and find out why 11.(any) fails miserably?
jbruns2019,
We're already looking into this. A similar issue was reported here. I'm adding the information you've provided to the collected data. We're sorry for the inconvenience.
Thanks,
Nedko