Hi everyone, I have an issue while attempting to create a linked clone pool via PowerCLI and JSON. Judging by the error below, I assume that the issue is with the AdContainer entry in my JSON file. I thought it was a formatting/syntax issue, but determined that cannot be correct as I exported my pool settings to JSON and it matches up. As it stands now, my syntax for AdContainer is:
"OU=Class8,OU=VDI,OU=Classroom PCs,OU=XX ,OU=XX COMPUTERS"
The line and char in the error does not correspond to AdContainer in my JSON. That line references VRamSizeMB. Not sure what other info I need to post. I can post my script and JSON file if requested. I'll need to redact some info out, but that should be fine.
New-HVPool : Failed to create Pool with error: Exception calling "ADContainer_ListByDomain" with "2" argument(s):
"ExceptionType : VMware.Hv.EntityNotFound
ErrorMessage : Unable to find specified entity
Id : VMware.Hv.ADDomainId"
At C:\Automation\JSON\VMPoolCreation.ps1:37 char:1
+ New-HVPool -spec ‘C:\Automation\JSON\TestLinkedClone1.json’
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-HVPool
Thanks in advance!
Could be.
The repo of the module indeed states Horizon 7.0.2 and later.
But I'm pretty sure some of the functions work with 6.* as well, perhaps this is then an example of one that doesn't.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Did you already try by leaving out the AdContainer entry from the JSON file?
The function should then enter the VM in "CN=Computers"
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Well, I tried CN=Computers, but didn't try leaving that portion out altogether. I'll test and see.
EDIT:
Tested and same error.
adContainer was empty using CN=Computers
New-HVPool : Failed to create Pool with error: Exception calling "ADContainer_ListByDomain" with "2" argument(s):
"ExceptionType : VMware.Hv.EntityNotFound
ErrorMessage : Unable to find specified entity
Id : VMware.Hv.ADDomainId"
At C:\Automation\JSON\VMPoolCreation.ps1:37 char:1
+ New-HVPool -spec ‘C:\Automation\JSON\TestLinkedClone1.json’
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-HVPool
The obvious error is that a lookup in the AD domain doesn't find the OU entry.
That seems to be confirmed by the fault (EntityNotFound) returned by the ADContainer_ListByDomain method.
You can also check if there might be an issue in your JSON file by using the WhatIf switch
ConvertTo-JSON -Depth 3
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Any idea if AdContainer is supposed to be canonical or the distinguished name? From my pool > json export, it shows as distinguished.
After adding the WhatIf, I pretty much received the same error:
adContainer was empty using CN=Computers
New-HVPool : Failed to create Pool with error: Exception calling "ADContainer_ListByDomain" with "2" argument(s):
"ExceptionType : VMware.Hv.EntityNotFound
ErrorMessage : Unable to find specified entity
Id : VMware.Hv.ADDomainId"
At C:\Automation\JSON\VMPoolCreation.ps1:37 char:1
+ New-HVPool -spec ‘C:\Automation\JSON\TestLinkedClone1.json’ -WhatIf
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-HVPool
I'm afraid I'm out of ideas.
My next step, would this be in my environment, would be to start debugging the function.
Also, since this is an open-sourced module I don't think you could open an SR for this issue.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could it be my creation script?
# Create a Linked Clone Desktop Pool in Horizon using PowerCLI and Defining parameters in JSON
# Variables
$cs = 'NameOfServer' #Horizon Connection Server (CS)
$Username = "NameOfDomain\AdminUser" #User account to connect to CS make sure you have necessary permissions
$SecurePassword = Get-Content C:\automation\creds.txt | ConvertTo-SecureString
$UserCredential = New-Object System.Management.Automation.PSCredential -ArgumentList $Username,$SecurePassword
# — Initialize All PowerCLI Modules —
#Importing the Hv.Helper Module for Horizon
Get-Module -ListAvailable ‘VMware.Hv.Helper’ | Import-Module
# Connect to Horizon Connection Server API Service
$hvServer1 = Connect-HVServer -Server $cs -Credential $UserCredential
# — Display Available Methods for interacting with the API Service API Service —
$Services1= $hvServer1.ExtensionData
# — Create the pool —
New-HVPool -spec ‘C:\Automation\JSON\TestLinkedClone1.json’ -WhatIf
ConvertTo-JSON -Depth 3
# — Disconnnect from Horizon API Service —
Disconnect-HVServer -Server $cs -Confirm:$false
Without further investigating your environment (AD setup, JSON file, View config) it would be very difficult to make meaningful comments I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I think I'll try doing this without the JSON. Just to see if that makes a difference.
Thank you for taking the time to read and help out. I appreciate it.
Just a thought, but could it be that this isn't working because I'm running Horizon 6.2.2?
Could be.
The repo of the module indeed states Horizon 7.0.2 and later.
But I'm pretty sure some of the functions work with 6.* as well, perhaps this is then an example of one that doesn't.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Apparently this is correct. After converting my script to use parameters instead of a JSON, debugging, and testing, I get the exact error that I originally posted. There is an incompatibility with the module and 6.2.2. While other modules work, new-hvpool does not. Shame.
We're updating sometime this summer though. Guess this will have to wait.