Open aalexanian opened 3 years ago
To Reproduce I'm using the following to run the script: New-AsBuiltReport -Report Nutanix.PrismElement -Target 10.11.65.10 -Credential (Get-Credential) -Format HTML,Word -OutputPath 'C:\Scripts\Asbuild-output' -TimeStamp -Verbose
Expected behavior expect it to finish the run without errors and produce the files.
I changed the info level to the following infolevel settings and still got the exact error! "InfoLevel": { "comment": "0 = Disabled, 1 = Enabled / Summary, 2 = Detailed, 3 = Adv Detailed, 4 = Comprehensive", "Cluster": 0, "System": 2, "Hosts": 0, "Storage": 0, "VM": 0, "DataProtection": 0 }, the I changed it to "InfoLevel": { "comment": "0 = Disabled, 1 = Enabled / Summary, 2 = Detailed, 3 = Adv Detailed, 4 = Comprehensive", "Cluster": 1, "System": 0, "Hosts": 0, "Storage": 0, "VM": 0, "DataProtection": 0 },
@aalexanian can you disable all InfoLevel sections and tell me if the report generates? This will help me diagnose where the problem might be.
Also, did you modify the default report JSON file or generate one? If you have generated one, you with need to specify the ReportConfigFilePath
parameter
After disabling all InfoLevel sections, the report was generated. The first time I ran the report, the AsBuiltReport.Nutanix.PrismElement.json was generated. I then modified the InfoLevel sections and ran it again but without overriding the json file.
Regards
Andre Alexanian @.***
On Thu, Sep 16, 2021 at 8:32 PM Tim Carman @.***> wrote:
@aalexanian https://github.com/aalexanian can you disable all InfoLevel sections and tell me if the report generates? This will help me diagnose where the problem might be. Also, did you modify the default report JSON file or generate one? If you have generated one, you with need to specify the ReportConfigFilePath parameter
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AsBuiltReport/AsBuiltReport.Nutanix.PrismElement/issues/12#issuecomment-921428309, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHUEGEWTPHZ3RSQB3TO7LA3UCKZDLANCNFSM5EGBNKAA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I'm also having this issue, but even after disabling all info levels, I still get the same error as OP. The only difference is we're using AOS. 5.15.7 LTS and not 5.15.6
Which hypervisor are you both running?
Mix of ESXi and AHV (Storage only Nodes)
Leave it with me. I'll see if I can get a lab spun up next week to do some further testing.
Thank you
Hi @tpcarman, just checking in to see if you'd had a chance to look at this any yet. Thanks
@pettcomputers unfortunately I cannot get access to a mixed ESXi & AHV environment like yours, however if you're willing to try and run some code we might be able to identify the issue. Modify the first line of the code below and replace <cluster IP>
with your Nutanix Prism / Cluster IP. Then, open a new PowerShell console and copy and paste each of the code snippets into the console. Once complete you should hopefully have your cluster name returned.
$ntnxpe = <cluster IP> # Replace with your Prism / Cluster IP
$credential = get-credential # When prompted, enter Prism credentials
function Get-NtnxApi {
[CmdletBinding()]
param (
[Parameter(
Mandatory = $true
)]
[ValidateNotNullOrEmpty()]
[Int] $Version,
[Parameter(
Mandatory = $true
)]
[ValidateNotNullOrEmpty()]
[String] $Uri
)
Begin {
#region Workaround for SelfSigned Cert an force TLS 1.2
if (-not ([System.Management.Automation.PSTypeName]'ServerCertificateValidationCallback').Type) {
$certCallback = @"
using System;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
public class ServerCertificateValidationCallback
{
public static void Ignore()
{
if(ServicePointManager.ServerCertificateValidationCallback ==null)
{
ServicePointManager.ServerCertificateValidationCallback +=
delegate
(
Object obj,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors errors
)
{
return true;
};
}
}
}
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
#endregion Workaround for SelfSigned Cert an force TLS 1.2
$username = $Credential.UserName
$password = $Credential.GetNetworkCredential().Password
$auth = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($username + ":" + $password ))
$api_v1 = "https://" + $NtnxPE + ":9440/PrismGateway/services/rest/v1"
$api_v2 = "https://" + $NtnxPE + ":9440/PrismGateway/services/rest/v2.0"
$headers = @{
'Accept' = 'application/json'
'Authorization' = "Basic $auth"
'Content-Type' = 'application/json'
}
}
Process {
Try {
Write-PScriboMessage -Message "Performing API reference call to $(($URI).TrimStart('/')) [$NtnxPE]"
# Check PowerShell version
if ($PSVersionTable.PSVersion.Major -eq "7") {
Switch ($Version) {
'1' { Invoke-RestMethod -Method Get -Uri ($api_v1 + $uri) -Headers $headers -SkipCertificateCheck }
'2' { Invoke-RestMethod -Method Get -Uri ($api_v2 + $uri) -Headers $headers -SkipCertificateCheck }
}
} elseif ($PSVersionTable.PSVersion.Major -eq "5") {
Switch ($Version) {
'1' { Invoke-RestMethod -Method Get -Uri ($api_v1 + $uri) -Headers $headers }
'2' { Invoke-RestMethod -Method Get -Uri ($api_v2 + $uri) -Headers $headers }
}
} else {
Throw
}
} Catch {
Write-Verbose -Message "Error with API reference call to $(($URI).TrimStart('/')) [$NtnxPE]"
Write-Verbose -Message $_
}
}
End {}
}
$NtnxCluster = Get-NtnxApi -Version 2 -Uri '/cluster'
$NtnxCluster | Select-Object -ExpandProperty Name
I am still having this issue above. Have narrowed it down to System InfoLevel. It successfully runs with all InfoLevels set to 0. Then changing them 1 at a time & errors when system is changed from 0.
I am running a pure ESXi environment. Also ran your code test above. It does NOT return the cluster name.
I have also tried removing latest ver 1.2.1 & installing older 1.2.0.1 with same error
Have tried running on both PS 5.1 & 7.3.3
OS: Windows 10 powershell Version 5.1.19041.2673 & 7.3.3 AOS 6.5.2.5 ESXi 7u3k
Still seeing this issue. Running with multiple versions of AOS 5.4.x & 6.5.x. Pure ESXi environment. any time would be appreciated to help solve.
@TMW999 have you tried running the code from my comments above?
@tpcarman I am having the same issue as @aalexanian .. I am an all Nutanix environment.. yes I have ran the above test you provided and I return no results..
Describe the bug I ran the Nutanix as build report for the first time on two different clusters and got the exact error. New-AsBuiltReport : Cannot bind argument to parameter 'Name' because it is an empty string. At line:1 char:1
Screenshot
Desktop (please complete the following information):