-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vsphere report error New-AsBuiltReport : Cannot bind argument to parameter 'Rows' because it is an empty collection. #69
Comments
Hey @EloiseJory, Thanks for logging the issue. Can you post a screenshot of the console just so we can confirm exactly where it is failing? Please obviously feel free to obfuscate any sensitive information like server names. What licenses do you have in this environment? What privileges does the account have that you are running the script as? Can you try loading the function below, and then after connecting to the vCenter Server with Connect-VIServer, please run the below and report back on what the output is:
Cheers, Matt. |
Hi Matt
Its using enterprise plus licencing.
Tried to import the function but get the error below:
PS H:\> get-license -vCenter vspherexxxxxxxxx
You cannot call a method on a null-valued expression.
At H:\get-license.ps1:64 char:9
+ $vCenterLicenseKey = "*****-*****-*****" + $vCenterLicense.Li ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
Product LicenseKey
------- ----------
From: Matt Allford [mailto:notifications@github.com]
Sent: Tuesday, 17 September 2019 2:41 PM
To: AsBuiltReport/AsBuiltReport.VMware.vSphere
Cc: Eloise Jory; Mention
Subject: Re: [AsBuiltReport/AsBuiltReport.VMware.vSphere] vsphere report error New-AsBuiltReport : Cannot bind argument to parameter 'Rows' because it is an empty collection. (#69)
Hey @EloiseJory<https://github.com/EloiseJory>,
Thanks for logging the issue. Can you post a screenshot of the console just so we can confirm exactly where it is failing? Please obviously feel free to obfuscate any sensitive information like server names.
What licenses do you have in this environment?
Can you try loading the function below, and then after connecting to the vCenter Server with Connect-VIServer, please run the below and report back on what the output is:
Get-License -vCenter vcenter.fqdn.com
Get-License -Licenses
`function Get-License {
<#
.SYNOPSIS
Function to retrieve vSphere product licensing information.
.DESCRIPTION
Function to retrieve vSphere product licensing information.
.NOTES
Version: 0.1.2
Author: Tim Carman
Twitter: @tpcarman<https://github.com/tpcarman>
Github: tpcarman
.PARAMETER VMHost
A vSphere ESXi Host object
.PARAMETER vCenter
A vSphere vCenter Server object
.PARAMETER Licenses
All vSphere product licenses
.INPUTS
System.Management.Automation.PSObject.
.OUTPUTS
System.Management.Automation.PSObject.
.EXAMPLE
PS> Get-License -VMHost ESXi01
.EXAMPLE
PS> Get-License -vCenter VCSA
.EXAMPLE
PS> Get-License -Licenses
#>
[CmdletBinding()][OutputType('System.Management.Automation.PSObject')]
Param
(
[Parameter(Mandatory = $false, ValueFromPipeline = $false)]
[ValidateNotNullOrEmpty()]
[PSObject]$vCenter,
[PSObject]$VMHost,
[Parameter(Mandatory = $false, ValueFromPipeline = $false)]
[Switch]$Licenses
)
$LicenseObject = @()
$ServiceInstance = Get-View ServiceInstance -Server $vCenter
$LicenseManager = Get-View $ServiceInstance.Content.LicenseManager -Server $vCenter
$LicenseManagerAssign = Get-View $LicenseManager.LicenseAssignmentManager -Server $vCenter
if ($VMHost) {
$VMHostId = $VMHost.Extensiondata.Config.Host.Value
$VMHostAssignedLicense = $LicenseManagerAssign.QueryAssignedLicenses($VMHostId)
$VMHostLicense = $VMHostAssignedLicense.AssignedLicense
if ($VMHostLicense.LicenseKey -and $Options.ShowLicenseKeys) {
$VMHostLicenseKey = $VMHostLicense.LicenseKey
} else {
$VMHostLicenseKey = "*****-*****-*****" + $VMHostLicense.LicenseKey.Substring(17)
}
$LicenseObject = [PSCustomObject]@{
Product = $VMHostLicense.Name
LicenseKey = $VMHostLicenseKey
}
}
if ($vCenter) {
$vCenterAssignedLicense = $LicenseManagerAssign.GetType().GetMethod("QueryAssignedLicenses").Invoke($LicenseManagerAssign, @($_.MoRef.Value)) | Where-Object { $_.EntityID -eq $vCenter.InstanceUuid }
$vCenterLicense = $vCenterAssignedLicense.AssignedLicense
if ($vCenterLicense.LicenseKey -and $Options.ShowLicenseKeys) {
$vCenterLicenseKey = $vCenterLicense.LicenseKey
} else {
$vCenterLicenseKey = "*****-*****-*****" + $vCenterLicense.LicenseKey.Substring(17)
}
$LicenseObject = [PSCustomObject]@{
Product = $vCenterLicense.Name
LicenseKey = $vCenterLicenseKey
}
}
if ($Licenses) {
foreach ($License in $LicenseManager.Licenses) {
if ($Options.ShowLicenseKeys) {
$LicenseKey = $License.LicenseKey
} else {
$LicenseKey = "*****-*****-*****" + $License.LicenseKey.Substring(17)
}
$Object = [PSCustomObject]@{
'Product' = $License.Name
'LicenseKey' = $LicenseKey
'Total' = $License.Total
'Used' = $License.Used
}
$LicenseObject += $Object
}
}
Write-Output $LicenseObject
}`
Cheers, Matt.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#69?email_source=notifications&email_token=ALW4BFZ5IFNVNMYL65TDXKTQKBNUNA5CNFSM4IXKO2TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD63IM6Q#issuecomment-532055674>, or mute the thread<https://github.com/notifications/unsubscribe-auth/ALW4BF4G2BK7KLCSAJDOPVLQKBNUNANCNFSM4IXKO2TA>.
This email is intended solely for the named addressee.
If you are not the addressee indicated please delete it immediately.
|
Hi @EloiseJory, Can you try running the following please and sharing the output, while obfuscating the License Keys (please just replace charaters with "x" so we know there was output there.
|
LicenseKey : 00000-00000-00000-00000-00000 LicenseKey : xxxxxx LicenseKey : xxxxxx LicenseKey : xxxxxxxx |
Hmm. And then these please (following on from the previous commands):
|
there are 2 vcenters in linked mode, however I've previously run the asbuilt report on them one at a time with no problem in 6.5 . This is the first attempt at a 6.7 as built report PS H:> $LicenseManagerAssign = Get-View $LicenseManager.LicenseAssignmentManager -Server $vcenter EntityId : host-31 EntityId : host-34 EntityId : 2f63f088-a629-4d65-a524-fd2e9fd998b4 EntityId : host-31 EntityId : host-531 EntityId : host-1072 EntityId : host-393 EntityId : host-34 EntityId : host-1065 EntityId : host-1838 EntityId : host-388 EntityId : 01ab82aa-4913-43a5-bfd9-a2f7470ac059 PS H:> |
Thoughts @tpcarman? |
can I stop the licence part from running? comment out something? |
Is there a section I can comment out so the report will run without licencing info? |
@EloiseJory It's probably worth having a look at your environment and seeing what is happening first hand. Would that be possible? Can we arrange a screen sharing session at some stage? |
@tpcarman ill have to check with management and get back to you.... |
@EloiseJory I believe I have identified the issue and looking to include the fix in the next update, due soon. Let me know if you wish to test before release. |
## [1.1.2] - 2019-12-09 ### Added - Added check for minimum VMware PowerCLI version (Fix AsBuiltReport#72) - Added VM summary information - Added VM disk and guest volume information - Added Virtual Switch to VMkernel adapter information - Added vSAN Disk Groups, iSCSI Targets & LUN reporting ### Changed - Improved report formatting - Improved VMHost storage adapter reporting (Fix AsBuiltReport#32) - Improved VMHost network adapter CDP reporting - Improved VM SCSI controller reporting - Updated report JSON structure & default settings. A new report JSON must be generated for this release, use `New-AsBuiltReportConfig -Report VMware.vSphere -Path <path> -Overwrite`. - Updated README with minimum required privileges to generate a VMware vSphere As Built Report. Full administrator privileges should no longer be required. - Resolved issue with PCI device reporting when ESXi hosts have FCoE adapters (Fix AsBuiltReport#33) - Resolved issue with reporting of ESXi boot device size (Fix AsBuiltReport#65) - Resolved issue with vSphere licensing (Fix # 68 & AsBuiltReport#69) ## Removed - Removed support for ESX/ESXi hosts prior to vSphere 5.0 (Fix AsBuiltReport#67)
I can give it a test... |
Describe the bug
Running as built vsphere report on venter 6.7 u2 and get : Cannot bind argument to parameter 'Rows' because it is an empty collection. just after the processing licensing
To Reproduce
Steps to reproduce the behavior:
New-AsBuiltReport -Report VMware.vSphere -Target 111.222.333.444 -Username vcheck -Password z********** -Format HTML,Word -OutputPath 'd:\Reports'
Expected behavior
Report output into d:\reports.
System (please provide the following information about the system from which you are trying to generate a report):
Major Minor Build Revision
5 1 14393 2969
3rd party PowerShell module name and version
VMware PowerCLI 10.0.0 build 7895300
AsBuiltReport Core 1.0.0 AsBuiltReport.Core
AsBuiltReport Report module name and version 1.1.0 AsBuiltReport.VMware.vSphere
The text was updated successfully, but these errors were encountered: