AsBuiltReport / AsBuiltReport.VMware.vSphere

Repository for AsBuiltReport VMware vSphere module
https://www.asbuiltreport.com
MIT License
110 stars 39 forks source link

InfoLevel greater than 2 for vCenter, VMHost, or VM produces errors #81

Closed bakins929 closed 4 years ago

bakins929 commented 4 years ago

Setting InfoLevel greater than 2 for some classes produces fatal errors. Detail for each scenario in screenshots section below.

To Reproduce Steps to reproduce the behavior:

  1. Set InfoLevel to 3 in AsBuiltReport.VMware.vSphere.json for vCenter, VMHost, or VM
  2. Run New-AsBuiltReport -Report VMware.vSphere [...]
  3. Wait
  4. See error

Expected behavior Produce the required output files.

Screenshots

    "InfoLevel": {
        "_comment_": "0 = Disabled, 1 = Summary, 2 = Informative, 3 = Detailed, 4 = Adv Detailed, 5 = Comprehensive",
        "vCenter": 2,
        "Cluster": 3,
        "ResourcePool": 3,
        "VMHost": 2,
        "Network": 3,
        "vSAN": 0,
        "Datastore": 3,
        "DSCluster": 3,
        "VM": 2,
        "VUM": 3
    },

This completes as expected and produces HTML and Text output defined with -Format HTML,Text parameters.

Setting vCenter to InfoLevel 3:

PS C:\PS-scripts> C:\PS-scripts\Reporting\vCenter\AsBuiltReports\New-Asbuilt_Report-DC1.ps1
New-AsBuiltReport : You cannot call a method on a null-valued expression.
At C:\PS-scripts\Reporting\vCenter\AsBuiltReports\New-Asbuilt_Report-DC1.ps1:4 char:1
+ New-AsBuiltReport -Report VMware.vSphere -Target $creds.Host -Timesta ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-AsBuiltReport

Setting VMHost to InfoLevel 3:

PS C:\PS-scripts> C:\PS-scripts\Reporting\vCenter\AsBuiltReports\New-Asbuilt_Report-DC1.ps1
Get-VMHostHardware : 8/28/2020 9:28:24 AM       Get-VMHostHardware              Permission to perform this operation was denied.
At C:\Program Files\WindowsPowerShell\Modules\AsBuiltReport.VMware.vSphere\1.1.3\Src\Public\Invoke-AsBuiltReport.VMware.vSphere.ps1:1793 char:63
+ ...                  $VMHostHardware = Get-VMHostHardware -VMHost $VMHost
+                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-VMHostHardware], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.GetVMHostHardware

New-AsBuiltReport : Permission to perform this operation was denied.
At C:\PS-scripts\Reporting\vCenter\AsBuiltReports\New-Asbuilt_Report-DC1.ps1:4 char:1
+ New-AsBuiltReport -Report VMware.vSphere -Target $creds.Host -Timesta ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-AsBuiltReport

Setting VM to InfoLevel 3:

PS C:\PS-scripts> C:\PS-scripts\Reporting\vCenter\AsBuiltReports\New-Asbuilt_Report-DC1.ps1
Get-SpbmEntityConfiguration : 8/28/2020 9:33:03 AM      Get-SpbmEntityConfiguration             Permission to perform this operation was denied. Required privilege 'StorageProfile.View' on managed object
with id 'Folder-group-d1'.
At C:\Program Files\WindowsPowerShell\Modules\AsBuiltReport.VMware.vSphere\1.1.3\Src\Public\Invoke-AsBuiltReport.VMware.vSphere.ps1:3639 char:49
+ ...        $VMSpbmConfig = Get-SpbmEntityConfiguration -VM ($VMs) | Where ...
+                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-SpbmEntityConfiguration], NoPermission
    + FullyQualifiedErrorId : Storage_SpbmProfileServiceImpl_GetAssociatedStoragePolicy_ViError,VMware.VimAutomation.Storage.Commands.Cmdlets.Spbm.GetSpbmEntityConfiguration

Hangs here until CTRL+C

System (please provide the following information about the system from which you are trying to generate a report):

Major Minor Build Revision


5 1 17763 1007

 - 3rd party PowerShell module name and version:

Version Name Repository Description


1.0.5 AsBuiltReport PSGallery A PowerShell module manifest which ins... 0.2.1 AsBuiltReport.Cisco.UcsManager PSGallery A PowerShell module to generate an as ... 1.0.5 AsBuiltReport.Core PSGallery A PowerShell module which provides the... 1.1.0 AsBuiltReport.Nutanix.PrismElement PSGallery A PowerShell module to generate an as ... 0.4.1 AsBuiltReport.PureStorage.FlashA... PSGallery A PowerShell module to generate an as ... 0.0.7 AsBuiltReport.Rubrik.CDM PSGallery A PowerShell module to generate an as ... 1.0.0 AsBuiltReport.VMware.ESXi PSGallery A PowerShell module to generate an as ... 0.4.1 AsBuiltReport.VMware.NSXv PSGallery A PowerShell module to generate as bui... 1.1.3 AsBuiltReport.VMware.vSphere PSGallery A PowerShell module to generate an as ... 3.0.0.10 Cisco.UCS.Common PSGallery PowerShell Module for Cisco Core (Core... 2.5.3.0 Cisco.UCS.Core PSGallery PowerShell Module for Cisco Core (Core... 3.0.0.10 Cisco.UCSManager PSGallery PowerShell Module for Cisco UCS Manage... 1.4.7 PackageManagement PSGallery PackageManagement (a.k.a. OneGet) is a... 2.2.4.1 PowerShellGet PSGallery PowerShell module with commands for di... 0.9.1 PScribo PSGallery PScribo documentation Powershell modul... 1.17.3.0 PureStoragePowerShellSDK PSGallery Pure Storage FlashArray REST API integ... 12.0.0.15947289 VMware.CloudServices PSGallery PowerCLI CloudServices sample module. 7.0.0.15902843 VMware.DeployAutomation PSGallery This Windows PowerShell module contain... 7.0.0.15902843 VMware.ImageBuilder PSGallery This Windows PowerShell module contain... 12.0.0.15947286 VMware.PowerCLI PSGallery This Windows PowerShell module contain... 7.0.0.15939650 VMware.Vim PSGallery This Windows PowerShell module contain... 12.0.0.15939657 VMware.VimAutomation.Cis.Core PSGallery This Windows PowerShell module contain... 12.0.0.15940183 VMware.VimAutomation.Cloud PSGallery This Windows PowerShell module contain... 12.0.0.15939652 VMware.VimAutomation.Common PSGallery This Windows PowerShell module contain... 12.0.0.15939655 VMware.VimAutomation.Core PSGallery This Windows PowerShell module contain... 12.0.0.15939647 VMware.VimAutomation.Hcx PSGallery This Windows PowerShell module contain... 7.12.0.15718406 VMware.VimAutomation.HorizonView PSGallery This Windows PowerShell module contain... 12.0.0.15939670 VMware.VimAutomation.License PSGallery This Windows PowerShell module contain... 12.0.0.15939671 VMware.VimAutomation.Nsxt PSGallery This Windows PowerShell module contain... 12.0.0.15939651 VMware.VimAutomation.Sdk PSGallery This Windows PowerShell module contain... 12.0.0.15939672 VMware.VimAutomation.Security PSGallery This Windows PowerShell module contain... 11.5.0.14899557 VMware.VimAutomation.Srm PSGallery This Windows PowerShell module contain... 12.0.0.15939648 VMware.VimAutomation.Storage PSGallery This Windows PowerShell module contain... 1.3.0.0 VMware.VimAutomation.StorageUtility PSGallery This Windows PowerShell module contain... 12.0.0.15940185 VMware.VimAutomation.Vds PSGallery This Windows PowerShell module contain... 12.0.0.15947287 VMware.VimAutomation.Vmc PSGallery This Windows PowerShell module contain... 12.0.0.15940184 VMware.VimAutomation.vROps PSGallery This Windows PowerShell module contain... 12.0.0.15947288 VMware.VimAutomation.WorkloadMan... PSGallery PowerShell commands for automation of ... 6.5.1.7862888 VMware.VumAutomation PSGallery This Windows PowerShell module contain...



 - AsBuiltReport Core module version: 1.0.5
 - AsBuiltReport Report module name and version: AsBuiltReport.VMware.vSphere 1.0.0

**Additional context**
administrator@vsphere.local was used for each New-AsBuiltReport to avoid any rights errors.
mattallford commented 4 years ago

Hey @bakins929,

Can you try running these with the raw New-AsBuiltReport command rather than wrapping it inside of the other ps1 (such as New-Asbuilt_Report-DC1.ps1) and also using the -Verbose parameter on New-AsBuiltReport? This might give us a slightly better indication of exactly which item it is failing on.

Cheers, Matt.

tpcarman commented 4 years ago

Hi @bakins929,

As @mattallford has said, if you could please provide the full command line you are using, together with verbose output that should help. I believe the upcoming module update should fix the issues you're having within the vCenter section however something looks rather odd with the other issues you have. This New-AsBuiltReport -Report VMware.vSphere -Target $creds.Host looks rather odd to me. The -Target parameter should be the vCenter server FQDN/IP address, not a stored credential or ESXi host address.

Cheers, Tim

bakins929 commented 4 years ago

Sure, I will be glad to run them outside a wrapper script and with verbose. Verbose has a ton of identifying info in it. I will have to sanitize the output before posting on git-hub.

bakins929 commented 4 years ago

Running vCenter set to 3 on my other vCenter yielded the same results. End of output:

VERBOSE: [ 16:07:10:882 ] [ Document ] - Processing table 'VM Snapshot Information'.
VERBOSE: [ 16:07:10:898 ] [ Document ] - Processing section 'Snapshots' completed.
VERBOSE: [ 16:07:10:898 ] [ Document ] - Processing section 'Virtual Machines' completed.
WARNING: There were one or more problems with the Update Manager Server certificate:

* The X509 chain could not be built up to the root certificate.
VERBOSE: [ 16:07:12:109 ] [ Document ] - Processing section 'VMware Update Manager' started.
VERBOSE: [ 16:07:12:109 ] [ Document ] - Processing paragraph 'The following sections detail the co[..]'.
VERBOSE: [ 16:07:12:125 ] [ Document ] - Processing section 'Baselines' started.
VERBOSE: [ 16:07:12:125 ] [ Document ] - Processing table 'VMware Update Manager Baseline Information'.
VERBOSE: [ 16:07:12:140 ] [ Document ] - Processing section 'Baselines' completed.
VERBOSE: [ 16:07:13:347 ] [ Document ] - Processing section 'VMware Update Manager' completed.
VERBOSE: [ 16:07:13:347 ] [ Document ] - Processing section 'vCenter2.mycompany.com' completed.
VERBOSE: [ 16:07:13:409 ] [ Document ] - Document 'VMware vSphere As Built Report - 2020-08-29_15.52.23' processing completed.
VERBOSE: [ 16:07:13:425 ] [ Document ] - Total processing time '14.84' minutes.
New-AsBuiltReport : Exception calling "IsNullOrEmpty" with "1" argument(s): "Server vsphere.local\administrator@vCenter2.mycompany.com:443 is not connected."
At line:1 char:1
+ New-AsBuiltReport -Report VMware.vSphere -AsBuiltConfigPath "C:\PS-sc ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,New-AsBuiltReport
bakins929 commented 4 years ago

VMHost and VM both completed this time when set to 3. I ran each individually with the other set back to 2. vCenter set to 3 failed. Attaching sanitized verbose output in txt file.

Issue_81-vCenter_3_output.txt

mattallford commented 4 years ago

Thanks for this @bakins929, it definitely looks like https://github.com/AsBuiltReport/AsBuiltReport.VMware.vSphere/issues/77

But this fix hasn't made it in to production yet. @tpcarman what is the timeline for this?

@bakins929, it would be great if you are able to download the dev branch of AsBuiltReport.VMware.vSphere and rerun to see if it resolves the issue you are experiencing.

tpcarman commented 4 years ago

I have just opened a pull request for the next release of the vSphere As Built Report.

This release should address the issues you are seeing with the vCenter section @bakins929. It is going through some further testing at the moment and is probably a week or two away from being published.

You can however download and test using the link here.

Please note that this release will also require the updated AsBuiltReport Core Module which is also currently in testing.

Check the Module Installation section within the README documentation for instructions on how to install from GitHub.

If you do test the newer releases and happen to encounter new issues, please open a new GitHub issue.

I hope this helps.

Cheers, Tim

bakins929 commented 4 years ago

I can do this Monday. Thank you both for your work on this project!

bakins929 commented 4 years ago

That did the job! Ran as default config, all 3's except VM and it completed:

VERBOSE: [ 18:09:07:862 ] [ Document ] - Processing section 'DC-01.mycompany.com' completed.
VERBOSE: [ 18:09:08:575 ] [ Document ] - Document 'VMware vSphere As Built Report - 2020-08-31_17.20.33' processing completed.
VERBOSE: [ 18:09:08:583 ] [ Document ] - Total processing time '48.59' minutes.
VMware vSphere As Built Report - 2020-08-31_17.20.33 has been saved to D:\Reports\

Thanks!!

tpcarman commented 4 years ago

@bakins929 Just to clarify, it was the new code which resolved the issue? Are you happy for me to close this issue now?

bakins929 commented 4 years ago

Yes, sorry. The new code resolved the issue. I'm ok to close the case. Thank you.

tpcarman commented 4 years ago

Issue resolved by #82