AsBuiltReport / AsBuiltReport.VMware.vSphere

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

vSAN 8 ESA - "VsanDiskGroup" is empty #113

Open mpacholke opened 10 months ago

mpacholke commented 10 months ago

vSAN 8 ESA has no disk groups anymore. The argument is NULL or empty

Perhaps you can skip the vSAN disk group information in the script ?

Update:

Test with the RC run into the same error:

ModuleType Version Name ExportedCommands


Script 1.3.4 AsBuiltReport.VMware.vSphere Invoke-AsBuiltReport.VMware.vSphere

New-AsBuiltReport : The argument for the VsanDiskGroup parameter cannot be verified. The argument is NULL or empty. Provide an argument that is not NULL or empty, and run the command again. In line:1 character:1

ESXi 8.0.2 Build 22380479 vCenter 8.0.2 Build 22385739

Name Value


PSVersion 5.1.19041.3693 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...} BuildVersion 10.0.19041.3693 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1

PowerCLI Version

VMware.PowerCLI 13.2.1 build 22851661

Component Versions

VMware Common PowerCLI Component 13.2 build 22643733 VMware Cis Core PowerCLI Component PowerCLI Component 13.2 build 22643734 VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 13.2 build 22643732 VMware VimAutomation Storage PowerCLI Component PowerCLI Component 13.2 build 22643728 VMware VimAutomation Vds Commands PowerCLI Component PowerCLI Component 13.1 build 21610933

baukeplugge commented 4 months ago

Same issue here.

got it working with some tweaks:

added an extra line to $VsanClusterInfo

'vSAN ESA Enabled' = Switch ($VsanCluster.VsanEsaEnabled) {
                                            $true { 'Yes' }
                                            $false { 'No' } 
                                        }

in the vsanclusters loop I excluded the OSA disk details

if (!($VsanCluster.VsanEsaEnabled -eq $true)){
$VsanDiskGroup = Get-VsanDiskGroup -Cluster $VsanCluster.Cluster
$NumVsanDiskGroup = $VsanDiskGroup.Count
$VsanDisk = Get-VsanDisk -VsanDiskGroup $VsanDiskGroup
$VsanDiskFormat = $VsanDisk.DiskFormatVersion | Select-Object -First 1 -Unique
$NumVsanSsd = ($VsanDisk | Where-Object { $_.IsSsd -eq $true }).Count
$NumVsanHdd = ($VsanDisk | Where-Object { $_.IsSsd -eq $false }).Count
if ($NumVsanHdd -gt 0) {
$VsanClusterType = "Hybrid"
} else {
$VsanClusterType = "All Flash"
}
} else {
$VsanClusterType = "All Flash (NVMe)"
}

I removed these 3 lines from the clusterdetail object and added them only if there is no ESA

if (!($VsanCluster.VsanEsaEnabled -eq $true)){
$VsanClusterDetail | Add-Member -MemberType NoteProperty -name 'Disk Format Version' -value $VsanDiskFormat
$VsanClusterDetail | Add-Member -MemberType NoteProperty -name 'Total Number of Disks' -value $NumVsanSsd + $NumVsanHdd
$VsanClusterDetail | Add-Member -MemberType NoteProperty -name 'Total Number of Disk Groups' -value $NumVsanDiskGroup
}

lastly I excluded the whole section disk groups and disks. These are depended on the diskgroup which do no exist anymore

if (!($VsanCluster.VsanEsaEnabled -eq $true)){
.....
}

for the exclusion.

the result is that the report is created only the ESA lines are not included in the report yet.

tpcarman commented 4 months ago

I have this coded already, however I got distracted while testing it in a few environments. I'll aim to push this up to the repo over the Easter weekend and you can test it further.

mpacholke commented 4 months ago

Are you sure that it is fixed?

DETAILED: [ 14:41:03:404 ] [ Document ] - Processing paragraph 'The following sections detail the co[..]'. VERBOSE: [ 14:41:03:407 ] [ Document ] - Processing section 'vsan-cluster' started. New-AsBuiltReport : The argument for the VsanDiskGroup parameter cannot be verified. The argument is NULL or empty. Provide an argument that is not NULL or empty and run the command again. In line:1 character:1

I have to mention that i installed a prerelease version while we tested in the last month:

Version Name Repository Description


1.4.0 AsBuiltReport.Core PSGallery A PowerShell module which provides the core framework for generating As-Built documentation ... 1.3.4-rc1 AsBuiltReport.VMware.vSphere PSGallery A PowerShell module to generate an as built report on the configuration of VMware vSphere

The update with the --force gives no errors but am not sure if the correct module is active now

WARNUNG: [ 14:52:25:303 ] [ Module ] - AsBuiltReport.VMware.vSphere 1.3.4.1 is currently installed.

To be sure i need to uninstall the prerelease and install from scratch but i get this error:

PackageManagement\Uninstall-Package : The module 'AsBuiltReport.VMware.vSphere' of version '1.3.4-rc1' in module base folder 'C:\Program Files\WindowsPowerShell\Modules\AsBuiltReport.VMware.vSphere\1.3.4' was installed without side-by-side version support. Some versions are installed in this module base with side-by-side version support. Uninstall other versions of this module before uninstalling the most current version. In C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:12733 Zeichen:21

mpacholke commented 4 months ago

Update: i was able to remove all installed versions and reinstall the actual module:

ModuleType Version Name ExportedCommands


Script 1.3.4.1 AsBuiltReport.VMware.vSphere Invoke-AsBuiltReport.VMware.vSphere

The error remains:

New-AsBuiltReport : The argument for the VsanDiskGroup parameter cannot be verified. The argument is NULL or empty. Provide an argument that is not NULL or empty and run the command again. In line:1 character:1

tpcarman commented 4 months ago

@mpacholke Can you please provide a verbose output or screenshot of where it is failing?

mpacholke commented 4 months ago

image

It is a german windows jump host

tpcarman commented 4 months ago

What vSphere & VSAN version are you using?

What is the VSAN InfoLevel configured for within the report configuration JSON?

mpacholke commented 4 months ago

Here the versions and info's:

ESXi 8.0.2 23305546

vCenter : Version Build


8.0.2 23319993

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

I varied the setting for vSAN to 1 and 0 but the error remains

tpcarman commented 4 months ago

Can you please provide further information about your VSAN cluster? Is it ESA or OSA? Hybrid or SSD?

Try and run this and share the output file.

$VcenterServer = "Your vCenter Server name"
$VsanCluster = "Your VSAN cluster name"

$vccreds = Get-Credential
$vcenter = connect-viserver $VcenterServer -Credential $vccreds

# Set verbose and debug preferences
$global:VerbosePreference = 'Continue'
$global:DebugPreference = 'Continue'

Start-Transcript -Path .\Output.log

$VsanCluster = Get-VsanClusterConfiguration -Cluster $VsanCluster -Server $vCenter | Where-Object { $_.vsanenabled -eq $true }

if ($VsanCluster) {
    if ($VsanCluster.VsanEsaEnabled) {
        $VsanStoragePoolDisk = Get-VsanStoragePoolDisk -Cluster $VsanCluster.Cluster
        $VsanDiskFormat = $VsanStoragePoolDisk.DiskFormatVersion | Select-Object -First 1 -Unique
        $VsanClusterDetail = [PSCustomObject]@{
            'Cluster' = $VsanCluster.Name
            'ID' = $VsanCluster.Id
            'vSAN Type' = Switch ($VsanCluster.VsanEsaEnabled) {
                $true { 'vSAN ESA' }
                $null { 'vSAN OSA' }
            }
            'Stretched Cluster' = Switch ($VsanCluster.StretchedClusterEnabled) {
                $true { 'Yes' }
                $false { 'No' }
            }
            'Number of Hosts' = $VsanCluster.Cluster.ExtensionData.Host.Count
            'Number of Disks' = $VsanStoragePoolDisk.Count
            'Disk Claim Mode' = $VsanCluster.VsanDiskClaimMode
            'Disk Format Version' = $VsanDiskFormat
            'Deduplication & Compression' = Switch ($VsanCluster.SpaceEfficiencyEnabled) {
                $true { 'Enabled' }
                $false { 'Disabled' }
                $null { 'Disabled' }
            }
            'Encryption' = Switch ($VsanCluster.EncryptionEnabled) {
                $true { 'Enabled' }
                $false { 'Disabled' }
                $null { 'Disabled' }
            }
            'Health Check' = Switch ($VsanCluster.HealthCheckEnabled) {
                $true { 'Enabled' }
                $false { 'Disabled' }
                $null { 'Disabled' }
            }
            'HCL Last Updated' = $VsanCluster.TimeOfHclUpdate
        }
    } else {
        $VsanDiskGroup = Get-VsanDiskGroup -Cluster $VsanCluster.Cluster
        $NumVsanDiskGroup = $VsanDiskGroup.Count
        $VsanDisk = Get-VsanDisk -VsanDiskGroup $VsanDiskGroup
        $VsanDiskFormat = $VsanDisk.DiskFormatVersion | Select-Object -First 1 -Unique
        $NumVsanSsd = ($VsanDisk | Where-Object { $_.IsSsd -eq $true }).Count
        $NumVsanHdd = ($VsanDisk | Where-Object { $_.IsSsd -eq $false }).Count
        if ($NumVsanHdd -gt 0) {
            $VsanClusterType = "Hybrid"
        } else {
            $VsanClusterType = "All Flash"
        }
        $VsanClusterDetail = [PSCustomObject]@{
            'Cluster' = $VsanCluster.Name
            'ID' = $VsanCluster.Id
            'vSAN Type' = Switch ($VsanCluster.VsanEsaEnabled) {
                $true { 'vSAN ESA' }
                $null { 'vSAN OSA' }
            }
            'Storage Type' = $VsanClusterType
            'Stretched Cluster' = Switch ($VsanCluster.StretchedClusterEnabled) {
                $true { 'Yes' }
                $false { 'No' }
            }
            'Number of Hosts' = $VsanCluster.Cluster.ExtensionData.Host.Count
            'Number of Disks' = $NumVsanSsd + $NumVsanHdd
            'Number of Disk Groups' = $NumVsanDiskGroup
            'Disk Claim Mode' = $VsanCluster.VsanDiskClaimMode
            'Disk Format Version' = $VsanDiskFormat
            'Deduplication & Compression' = Switch ($VsanCluster.SpaceEfficiencyEnabled) {
                $true { 'Enabled' }
                $false { 'Disabled' }
                $null { 'Disabled' }
            }
            'Encryption' = Switch ($VsanCluster.EncryptionEnabled) {
                $true { 'Enabled' }
                $false { 'Disabled' }
                $null { 'Disabled' }
            }
            'Health Check' = Switch ($VsanCluster.HealthCheckEnabled) {
                $true { 'Enabled' }
                $false { 'Disabled' }
                $null { 'Disabled' }
            }
            'HCL Last Updated' = $VsanCluster.TimeOfHclUpdate
        }
        Write-Output $VsanClusterDetail | fl
    }
} else {
    Write-Error -Message "VSAN cluster not found!"
}

Stop-Transcript

# Reset verbose and debug preferences
$global:VerbosePreference = 'SilentlyContinue'
$global:DebugPreference = 'SilentlyContinue'
mpacholke commented 4 months ago

Hi sorry for the delay. I only have access to the customer site at dedicated time frames. This is a vSAN ESA (all-nvme) cluster.

image

I have to anonymize some data:

cat .\Output.log


Start der Windows PowerShell-Aufzeichnung Startzeit: 20240422171639 Benutzername: mydom\Administrator RunAs-Benutzer: mydom\Administrator Konfigurationsname: Computer: ws1 (Microsoft Windows NT 10.0.19045.0) Hostanwendung: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command try { . "c:\Users\Administrator.mydom\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\contrib\terminal\browser\media\shellIntegration.ps1" } catch {} Prozess-ID: 9556 PSVersion: 5.1.19041.4291 PSEdition: Desktop PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.19041.4291 BuildVersion: 10.0.19041.4291 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1


Die Aufzeichnung wurde gestartet. Die Ausgabedatei ist ".\Output.log". AUSFÜHRLICH: 22.04.2024 17:16:39 Get-VsanClusterConfiguration Finished execution AUSFÜHRLICH: 22.04.2024 17:16:43 Get-VsanStoragePoolDisk Finished execution


Ende der Windows PowerShell-Aufzeichnung Endzeit: 20240422171643 **@**

mpacholke commented 3 weeks ago

i run the script again and after some errors i got this tail . I removed all personal information:


nStart der Windows PowerShell-Aufzeichnung Startzeit: 20240725191638

Konfigurationsname: Computer: SP77205NB-1218 (Microsoft Windows NT 10.0.19045.0) Hostanwendung: C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command Import-Module 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2024.2.2\modules\PowerShellEditorServices\PowerShellEditorServices.psd1'; Start-EditorServices -HostName 'Visual Studio Code Host' -HostProfileId 'Microsoft.VSCode' -HostVersion '2024.2.2' -BundledModulesPath 'c:\Users\Administrator.vscode\extensions\ms-vscode.powershell-2024.2.2\modules' -EnableConsoleRepl -StartupBanner "PowerShell Extension v2024.2.2 Copyright (c) Microsoft Corporation.

https://aka.ms/vscode-powershell Type 'help' to get help. " -LogLevel 'Normal' -LogPath 'c:\Users\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\logs\1721927401-44981674-1f94-49d9-9e8a-f688390390fc1721926883641' -SessionDetailsPath 'c:\Users\Administrator\AppData\Roaming\Code\User\globalStorage\ms-vscode.powershell\sessions\PSES-VSCode-5244-395128.json' -FeatureFlags @() Prozess-ID: 5800 PSVersion: 5.1.19041.4522 PSEdition: Desktop PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.19041.4522 BuildVersion: 10.0.19041.4522 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1


Die Aufzeichnung wurde gestartet. Die Ausgabedatei ist ".\Output.log". PS>TerminatingError(Get-VsanClusterConfiguration): "Das Argument für den Parameter "Server" kann nicht überprüft werden. Das Argument ist NULL oder leer. Geben Sie ein Argument an, das nicht NULL oder leer ist, und führen Sie den Befehl erneut aus." Get-VsanClusterConfiguration : Das Argument für den Parameter "Server" kann nicht überprüft werden. Das Argument ist NULL oder leer. Geben Sie ein Argument an, das nicht NULL oder leer ist, und führen Sie den Befehl erneut aus. In \code\test-asbuilt.ps1:14 Zeichen:75

AUSFÜHRLICH: 25.07.2024 19:16:42 Get-VsanDiskGroup Finished execution PS>TerminatingError(Get-VsanDisk): "Das Argument für den Parameter "VsanDiskGroup" kann nicht überprüft werden. Das Argument ist NULL oder leer. Geben Sie ein Argument an, das nicht NULL oder leer ist, und führen Sie den Befehl erneut aus." Get-VsanDisk : Das Argument für den Parameter "VsanDiskGroup" kann nicht überprüft werden. Das Argument ist NULL oder leer. Geben Sie ein Argument an, das nicht NULL oder leer ist, und führen Sie den Befehl erneut aus. In \code\test-asbuilt.ps1:55 Zeichen:49

Cluster : ID : vSAN Type : vSAN OSA Storage Type : All Flash Stretched Cluster : Number of Hosts : 0 Number of Disks : 0 Number of Disk Groups : 0 Disk Claim Mode : Disk Format Version : Deduplication & Compression : Disabled Encryption : Disabled Health Check : Disabled HCL Last Updated :


Ende der Windows PowerShell-Aufzeichnung Endzeit: 20240725191642