HomeLab – VMware SRM Documentation with AsBuiltReport

Hello everyone!

These last weeks I have been working on improving my coding skills taking into account that now the trend is “Software Defined Everything”. This time I have been spending time on PowerShell creating several reports through the AsBuildReport project created by “Tim Carman” @tpcarman (Link Here).

The report I helped finish this time is related to documenting VMware Site Recovery Manager installations. The report was initially created by “Matt Allford” @mattallford and I took on the task of trying to finish the work that had already been started.

According to VMware’s documentation portal:

Site Recovery Manager (SRM) is the leading disaster recovery management solution designed to minimize downtime in the event of a disaster. It provides policy-based management and automated coordination, and enables testing of centralized recovery plans without disruption. It is designed for virtual machines and is scalable to manage all applications in a vSphere environment.

VMware Documentation

The report is in an initial state and in constant development, but I decided to release it publicly to receive recommendations or rather to encourage other developers to contribute to improve its content. The development website of the report is in Github I leave the link so you can see the scope and objective of the project.

Now, to get started we need to meet the following requirements:

  • Multi-platform Windows, Linux or MAC
  • PowerShell v5.1+ ó v7
  • AsBuiltReport.Core Module >= 1.1.0
  • VMware PowerCLI Module >= 12.3+

This report uses PowerShell version 5.+ or PSCore 7, to validate the version we can use the $PSVersionTable variable from the PowerShell console:

PS /home/rebelinux> $PSVersionTable


Name                           Value
----                           -----
PSVersion                      7.2.0
PSEdition                      Core
GitCommitId                    7.2.0
OS                             Linux 5.15.4-arch1-1 #1 SMP PREEMPT Sun, 21 Nov 2021 21:34:33 +0000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS /home/rebelinux> 

To validate if we have the required modules we can use the “Get-Module” command as shown in the following example:

PS /home/rebelinux> Get-Module -ListAvailable -Name @('VMware.PowerCLI','AsBuiltReport.Core')


    Directory: /home/rebelinux/.local/share/powershell/Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     1.1.0                 AsBuiltReport.Core                  Desk      {New-AsBuiltReport...}
Manifest   12.4.1.18…            VMware.PowerCLI                     Desk      

PS /home/rebelinux>

If the command does not produce any result it means that the modules are not installed. To install the dependency use the “Install-Module” command:

PS /home/rebelinux>  Install-Module -Name @('VMware.PowerCLI','AsBuiltReport.Core') 
                                                                                                                                                                                                                                                                              Installing package 'VMware.PowerCLI'   
                                                                                                                                                                                                                                                     Copying unzipped package to '..\2052046370\VMware.PowerCLI'  
                                                                                                                                                                                           [oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo]   
 
PS /home/rebelinux> 

Once the prerequisites are met continue with the installation of the main module “AsBuiltReport.VMware.SRM”. Since this report has not yet been publicly released in “PowerShell Gallery” you need to manually perform the installation. The first step is to download the code from Github portal here.

Once the code is downloaded the file needs to be unzipped, for this you can use the command “Expand-Archive”.

PS /home/rebelinux/Downloads> Expand-Archive -Path ./AsBuiltReport.VMware.SRM.zip -DestinationPath .

PS /home/rebelinux/Downloads> ls AsBuiltReport.VMware.SRM

AsBuiltReport.VMware.SRM.json  AsBuiltReport.VMware.SRM.psm1       CHANGELOG.md  README.md  Src
AsBuiltReport.VMware.SRM.psd1  AsBuiltReport.VMware.SRM.Style.ps1  LICENSE       Samples
PS /home/rebelinux/Downloads> 

Then it is necessary to copy the unzipped folder “AsBuiltReport.VMware.SRM” to a path set in $env:PSModulePath. The last step to follow if on “Windows OS” is to open a PowerShell window and unlock the downloaded files using the “Unblock-File” command.

$path = (Get-Module -Name AsBuiltReport.VMware.SRM -ListAvailable).ModuleBase; Unblock-File -Path $path\*.psd1; Unblock-File -Path $path\Src\Public\*.ps1; Unblock-File -Path $path\Src\Private\*.ps1

An optional requirement is to generate configuration files that allow you to set the organization parameters that are used to generate the report. This process generates JSON files that are used as templates so that you do not have to fill in repetitive information when generating reports. To view the configuration procedure, simply click on the “+” icon.

Archivos de configuración (AsBuiltReport JSON)

The powershell cmdlet New-AsBuiltConfig allows you to generate the template that is used as the basis of the report. This template sets the non-technical parameters of the report.

PS /home/rebelinux>  New-AsBuiltConfig

---------------------------------------------
 <        As Built Report Information      >
---------------------------------------------
Enter the name of the Author for this As Built Report [jocolon]: Jonathan Colon
---------------------------------------------
 <           Company Information           >
---------------------------------------------
Would you like to enter Company information for the As Built Report? (y/n): y
Enter the Full Company Name: Zen PR Solutions
Enter the Company Short Name: ZENPR
Enter the Company Contact: Jonathan Colon
Enter the Company Email Address: jcolonf@zenprsolutions.com
Enter the Company Phone: XXX-XXX-XXXX
Enter the Company Address: Puerto Rico
---------------------------------------------
 <            Email Configuration          >
---------------------------------------------
Would you like to enter SMTP configuration? (y/n): n
----------------------------------------------
 <       As Built Report Configuration      >
----------------------------------------------
Would you like to save the As Built Report configuration file? (y/n): y
Enter a name for the As Built Report configuration file [AsBuiltReport]: HomeLab SRM Report
Enter the path to save the As Built Report configuration file [/home/rebelinux/AsBuiltReport]:

Name                           Value
----                           -----
Email                          {Port, Credentials, Server, To...}
Company                        {FullName, Contact, Phone, Email...}
UserFolder                     {Path}
Report                         {Author}


PS /home/rebelinux>

Once the process is done, a JSON file will be created with the following content:

{
    "Email":  {
                  "Port":  null,
                  "Credentials":  null,
                  "Server":  null,
                  "To":  null,
                  "From":  null,
                  "UseSSL":  null,
                  "Body":  null
              },
    "Company":  {
                    "FullName":  "Zen PR Solutions",
                    "Contact":  "Jonathan Colon",
                    "Phone":  "787-203-2790",
                    "Email":  "jcolonf@zenprsolutions.com",
                    "ShortName":  "ZENPR",
                    "Address":  "Puerto Rico"
                },
    "UserFolder":  {
                       "Path":  "/home/rebelinux/AsBuiltReport"
                   },
    "Report":  {
                   "Author":  "Jonathan Colon"
               }
}

The New-AsBuiltReportConfig command allows you to set the technical parameters of the report such as the verbose level and type of information.

PS /home/rebelinux/ New-AsBuiltReportConfig VMware.SRM -FolderPath /home/rebelinux/AsBuiltReport/

Once the process is completed, a JSON file will be created with the following content:

{
    "Report": {
        "Name": "VMware SRM As Built Report",
        "Version": "1.0",
        "Status": "Released",
        "ShowCoverPageImage": true,
        "ShowTableOfContents": true,
        "ShowHeaderFooter": true,
        "ShowTableCaptions": true
    },
    "Options": {
        "ShowDefinitionInfo": false
    },
    "InfoLevel": {
        "_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed",
        "Summary": 1,
        "Protected": 1,
        "Recovery": 1,
        "ProtectionGroup": 1,
        "RecoveryPlan": 1,
        "InventoryMapping": 1
    },
    "HealthCheck": {
        "InventoryMapping": {
            "Status": true
        },
        "Protected": {
            "Status": true
        },
        "Recovery": {
            "Status": true
        }

    }
}

This configuration file can be used to specify the level of detail of the report as well as which report sessions are to be enabled.

Then you can generate the report using the command “New-AsBuiltReport -Report VMware.SRM -Target vCenter_FQDN_or_IP”. It is important to emphasize that it is required to use the “vCenter” server address as “Target”.

PS /home/rebelinux/> New-AsBuiltReport -Report VMware.SRM -AsBuiltConfigFilePath /home/rebelinux/script/AsBuiltReport.json -OutputFolderPath /home/rebelinux/script -Target 192.168.5.2 -Format HTML -Verbose -EnableHealthCheck -Credential $cred -ReportConfigFilePath /home/rebelinux/script/AsBuiltReport.VMware.SRM.json

VERBOSE: Loading As Built Report configuration from '/home/rebelinux/script/AsBuiltReport.json'.
VERBOSE: Loading module from path '/home/rebelinux/.local/share/powershell/Modules/AsBuiltReport.VMware.SRM/AsBuiltReport.VMware.SRM.psm1'.
VERBOSE: Loading AsBuiltReport.VMware.SRM report configuration file from path '/home/rebelinux/script/AsBuiltReport.VMware.SRM.json'.
VERBOSE: Setting report filename to 'VMware SRM As Built Report'.
VERBOSE: [ 12:49:41:970 ] [ Document ] - Document 'VMware SRM As Built Report' processing started.
VERBOSE: [ 12:49:42:016 ] [ Document ] - Executing report style script from path '/home/rebelinux/.local/share/powershell/Modules/AsBuiltReport.VMware.SRM\AsBuiltReport.VMware.SRM.Style.ps1'.
VERBOSE: [ 12:49:42:103 ] [ Document ] - Processing paragraph 'VMware SRM As Built Report'.
VERBOSE: [ 12:49:42:105 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:49:42:110 ] [ Document ] - Processing paragraph 'Zen PR Solutions'.
VERBOSE: [ 12:49:42:111 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:49:42:112 ] [ Document ] - Processing table 'Cover Page'.
VERBOSE: [ 12:49:42:114 ] [ Document ] - Processing page break.
VERBOSE: [ 12:49:42:115 ] [ Document ] - Processing table of contents 'Table of Contents'.
VERBOSE: [ 12:49:42:116 ] [ Document ] - Processing page break.
VERBOSE: [ 12:49:43:531 ] [ Document ] - Connected to protected site vCenter: 192.168.5.2
VERBOSE: [ 12:50:30:517 ] [ Document ] - Connected to vcenter-03v.zenpr.local
VERBOSE: [ 12:50:31:820 ] [ Document ] - Connected to protected site SRM: srmhq-01v.zenpr.local
VERBOSE: [ 12:50:31:821 ] [ Document ] - Processing section 'VMware Site Recovery Manager - SRMHQ-01V.' started.
VERBOSE: [ 12:50:31:823 ] [ Document ] - Processing paragraph 'VMware Site Recovery Manager is a bu[..]'.
VERBOSE: [ 12:50:31:833 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:31:835 ] [ Document ] - Summary InfoLevel set at 1.
VERBOSE: [ 12:50:36:372 ] [ Document ] - Processing table 'Placeholder Datastore Mappings - SRM-HQ'.
VERBOSE: [ 12:50:36:375 ] [ Document ] - Processing section 'Placeholder Datastore Mappings' completed.
VERBOSE: [ 12:50:36:376 ] [ Document ] - Processing section 'Inventory Mapping Summary' completed.
VERBOSE: [ 12:50:36:377 ] [ Document ] - Protected Site InfoLevel set at 1.
VERBOSE: [ 12:50:36:377 ] [ Document ] - Collecting SRM Protected Site information.
VERBOSE: [ 12:50:36:387 ] [ Document ] - Processing section 'Protected Site' started.
VERBOSE: [ 12:50:36:395 ] [ Document ] - Processing paragraph 'In a typical Site Recovery Manager i[..]'.
VERBOSE: [ 12:50:36:396 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:36:397 ] [ Document ] - Processing paragraph 'The following section provides a sum[..]'.
VERBOSE: [ 12:50:36:398 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:36:398 ] [ Document ] - Discovered Protected Site SRM-HQ.
VERBOSE: [ 12:50:36:480 ] [ Document ] - Processing table 'Protected Site Information - SRM-HQ'.
VERBOSE: [ 12:50:36:483 ] [ Document ] - Processing section 'Protected Site' completed.
VERBOSE: [ 12:50:36:483 ] [ Document ] - Recovery Site InfoLevel set at 1.
VERBOSE: [ 12:50:36:484 ] [ Document ] - Collecting SRM Recovery Site information.
VERBOSE: [ 12:50:36:535 ] [ Document ] - Processing section 'Recovery Site' started.
VERBOSE: [ 12:50:36:536 ] [ Document ] - Processing paragraph 'In a typical Site Recovery Manager i[..]'.
VERBOSE: [ 12:50:36:537 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:36:538 ] [ Document ] - Processing paragraph 'The following section provides a sum[..]'.
VERBOSE: [ 12:50:36:539 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:36:539 ] [ Document ] - Discovered Recovery Site SRM-EDGE.
VERBOSE: [ 12:50:36:551 ] [ Document ] - Processing table 'Recovery Site Information - SRM-EDGE'.
VERBOSE: [ 12:50:36:554 ] [ Document ] - Processing section 'Recovery Site' completed.
VERBOSE: [ 12:50:36:555 ] [ Document ] - Protection Group Site InfoLevel set at 2.
VERBOSE: [ 12:50:36:555 ] [ Document ] - Collecting SRM Protection Group information.
VERBOSE: [ 12:50:36:561 ] [ Document ] - Processing section 'Protection Groups Summary' started.
VERBOSE: [ 12:50:36:563 ] [ Document ] - Processing paragraph 'In Site Recovery Manager, protection[..]'.
VERBOSE: [ 12:50:36:566 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:36:567 ] [ Document ] - Processing paragraph 'The following section provides a sum[..]'.
VERBOSE: [ 12:50:36:570 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:36:673 ] [ Document ] - Discovered Protection Group ZENPR-DB-PG.
VERBOSE: [ 12:50:36:735 ] [ Document ] - Discovered Protection Group ZENPR-MON-PG.
VERBOSE: [ 12:50:36:789 ] [ Document ] - Discovered Protection Group ZENPR-WEB-PG.
VERBOSE: [ 12:50:36:841 ] [ Document ] - Discovered Protection Group ZENPR-APP-PG.
VERBOSE: [ 12:50:36:855 ] [ Document ] - Processing table 'Protection Group Information - ZENPR-APP-PG'.
VERBOSE: [ 12:50:36:858 ] [ Document ] - Processing section 'Protection Groups' started.
VERBOSE: [ 12:50:36:873 ] [ Document ] - Processing paragraph 'The following section provides detai[..]'.
VERBOSE: [ 12:50:36:874 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:36:892 ] [ Document ] - Processing section 'VMRS Type Protection Groups' started.
VERBOSE: [ 12:50:38:635 ] [ Document ] - Processing table 'VRMS Protection Group - ZENPR-APP-PG'.
WARNING: [ 12:50:38:639 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'VRMS Protection Group - ZENPR-APP-PG'.
VERBOSE: [ 12:50:38:639 ] [ Document ] - Processing section 'VMRS Type Protection Groups' completed.
VERBOSE: [ 12:50:38:640 ] [ Document ] - Processing section 'SAN Type Protection Groups' started.
VERBOSE: [ 12:50:39:145 ] [ Document ] - Processing table 'SAN Protection Group - ZENPR-APP-PG'.
VERBOSE: [ 12:50:39:147 ] [ Document ] - Processing section 'SAN Type Protection Groups' completed.
VERBOSE: [ 12:50:39:154 ] [ Document ] - Processing section 'Virtual Machine Protection Properties Summary' started.
VERBOSE: [ 12:50:39:167 ] [ Document ] - Processing paragraph 'The following section provides detai[..]'.
VERBOSE: [ 12:50:39:168 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:39:234 ] [ Document ] - Processing section 'ZENPR-DB-PG Protection Properties (PlaceHolder)' started.
VERBOSE: [ 12:50:39:804 ] [ Document ] - Processing table 'VM Recovery PlaceHolder - ZENPR-DB-PG'.
VERBOSE: [ 12:50:39:811 ] [ Document ] - Processing section 'ZENPR-DB-PG Protection Properties (PlaceHolder)' completed.
VERBOSE: [ 12:50:39:855 ] [ Document ] - Processing section 'ZENPR-MON-PG Protection Properties (PlaceHolder)' started.
VERBOSE: [ 12:50:40:156 ] [ Document ] - Processing table 'VM Recovery PlaceHolder - ZENPR-MON-PG'.
VERBOSE: [ 12:50:40:158 ] [ Document ] - Processing section 'ZENPR-MON-PG Protection Properties (PlaceHolder)' completed.
VERBOSE: [ 12:50:40:204 ] [ Document ] - Processing section 'ZENPR-WEB-PG Protection Properties (PlaceHolder)' started.
VERBOSE: [ 12:50:40:554 ] [ Document ] - Processing table 'VM Recovery PlaceHolder - ZENPR-WEB-PG'.
VERBOSE: [ 12:50:40:556 ] [ Document ] - Processing section 'ZENPR-WEB-PG Protection Properties (PlaceHolder)' completed.
VERBOSE: [ 12:50:41:181 ] [ Document ] - Processing table 'Recovery Plan Config - ZENPR-MON-RG'.
VERBOSE: [ 12:50:41:198 ] [ Document ] - Processing section 'Virtual Machine Recovery Settings Summary' started.
VERBOSE: [ 12:50:41:245 ] [ Document ] - Processing paragraph 'The following section provides detai[..]'.
VERBOSE: [ 12:50:41:246 ] [ Document ] - Processing blank line.
VERBOSE: [ 12:50:41:257 ] [ Document ] - Processing section 'ZENPR-DB-RG VM Recovery Settings' started.
VERBOSE: [ 12:50:41:349 ] [ Document ] - Discovered VM Setting Linux-DB-01V.
VERBOSE: [ 12:50:41:571 ] [ Document ] - Discovered VM Setting Linux-DB-02V.
VERBOSE: [ 12:50:41:616 ] [ Document ] - Processing table 'Virtual Machine Recovery Settings - ZENPR-DB-RG'.
VERBOSE: [ 12:50:41:619 ] [ Document ] - Processing section 'ZENPR-DB-RG VM Recovery Settings' completed.
VERBOSE: [ 12:50:41:649 ] [ Document ] - Processing section 'ZENPR-APP-RG VM Recovery Settings' started.
VERBOSE: [ 12:50:41:696 ] [ Document ] - Discovered VM Setting Linux-APP-01V.
VERBOSE: [ 12:50:41:706 ] [ Document ] - Processing table 'Virtual Machine Recovery Settings - ZENPR-APP-RG'.
VERBOSE: [ 12:50:41:709 ] [ Document ] - Processing section 'ZENPR-APP-RG VM Recovery Settings' completed.
VERBOSE: [ 12:50:41:721 ] [ Document ] - Processing section 'ZENPR-WEB-RG VM Recovery Settings' started.
VERBOSE: [ 12:50:41:766 ] [ Document ] - Discovered VM Setting Linux-WEB-01V.
VERBOSE: [ 12:50:41:777 ] [ Document ] - Processing table 'Virtual Machine Recovery Settings - ZENPR-WEB-RG'.
VERBOSE: [ 12:50:41:779 ] [ Document ] - Processing section 'ZENPR-WEB-RG VM Recovery Settings' completed.
VERBOSE: [ 12:50:41:791 ] [ Document ] - Processing section 'ZENPR-MON-RG VM Recovery Settings' started.
VERBOSE: [ 12:50:41:840 ] [ Document ] - Discovered VM Setting Linux-Mon-01v.
VERBOSE: [ 12:50:41:853 ] [ Document ] - Processing table 'Virtual Machine Recovery Settings - ZENPR-MON-RG'.
VERBOSE: [ 12:50:41:856 ] [ Document ] - Processing section 'ZENPR-MON-RG VM Recovery Settings' completed.
VERBOSE: [ 12:50:41:858 ] [ Document ] - Processing section 'Virtual Machine Recovery Settings Summary' completed.
VERBOSE: [ 12:50:41:860 ] [ Document ] - Processing section 'Recovery Plans Summary' completed.
VERBOSE: [ 12:50:41:862 ] [ Document ] - Processing section 'VMware Site Recovery Manager - SRMHQ-01V.' completed.
VERBOSE: [ 12:50:41:893 ] [ Document ] - Document 'VMware SRM As Built Report' processing completed.
VERBOSE: [ 12:50:41:897 ] [ Document ] - Total processing time '59.93' seconds.
VMware SRM As Built Report 'VMware SRM As Built Report' has been saved to '/home/rebelinux/script'.
PS /home/rebelinux/>

Here is an example of the generated report.

Additionally, I include several examples of how to invoke the report.

# Generate a VMware SRM As Built Report for vCenter Server 'vcenter.zenpr.local' using specified credentials. Export report to HTML & DOCX formats. Use default report style. Append timestamp to report filename. Save reports to 'C:\Users\Jon\Documents'

PS C:\> New-AsBuiltReport -Report VMware.SRM -Target 'vcenter.zenpr.local' -Username 'administrator@vsphere.local' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -Timestamp

# Generate a VMware SRM As Built Report for vCenter Server 'vcenter.zenpr.local' using specified credentials and report configuration file. Export report to Text, HTML & DOCX formats. Use default report style. Save reports to 'C:\Users\Jon\Documents'. Display verbose messages to the console.

PS C:\> New-AsBuiltReport -Report VMware.SRM -Target 'vcenter.zenpr.local' -Username 'administrator@vsphere.local' -Password 'P@ssw0rd' -Format Text,Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -ReportConfigFilePath 'C:\Users\Jon\AsBuiltReport\AsBuiltReport.VMware.SRM.json' -Verbose

# Generate a VMware SRM As Built Report for vCenter Server 'vcenter.zenpr.local' using stored credentials. Export report to HTML & Text formats. Use default report style. Highlight environment issues within the report. Save reports to 'C:\Users\Jon\Documents'.

PS C:\> $Creds = Get-Credential
PS C:\> New-AsBuiltReport -Report VMware.SRM -Target 'vcenter.zenpr.local' -Credential $Creds -Format Html,Text -OutputFolderPath 'C:\Users\Jon\Documents' -EnableHealthCheck

# Generate a VMware SRM As Built Report for vCenter Server 'vcenter.zenpr.local' using specified credentials. Export report to HTML & DOCX formats. Use default report style. Reports are saved to the user profile folder by default. Attach and send reports via e-mail.

PS C:\> New-AsBuiltReport -Report VMware.SRM -Target 'vcenter.zenpr.local' -Username 'administrator@vsphere.local' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -SendEmail

Hasta Luego Amigos!

PowerShell – VMware PowerCLI initial vCenter Connection

Hi all,

In the previous post I showed you how to install VMware PowerCLI and a basic introduction of the purpose of this management tool. In this post I will show you how to do the initial connection to the vCenter using the PowerCLI tool. It is important to mention that PowerCLI can be used to connect to both vCenter and vSphere “ESXi” server independently but in this post I will be showing examples only referring to the vCenter server.

To start, we need to establish the initial connection to our vCenter server. PowerCLI provides the “Connect-VIServer” command for this purpose but there are also other commands to manage and even validate existing connections. The following example shows how to deploy the vCenter connect/disconnect commands.

PS /home/rebelinux> Get-Command *VIserver*


CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           Get-VIServer                                       12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Connect-VIServer                                   12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Disconnect-VIServer                                12.4.0.18… VMware.VimAutomation.Core

PS /home/rebelinux>

By using the “Connect-VIServer” command we establish the initial connection to the vCenter with the IP address “192.168.5.2” on my HomeLab.

PS /home/rebelinux> Connect-VIServer -Server 192.168.5.2 -Credential (Get-Credential)

PowerShell credential request
Enter your credentials.
User: administrator@vsphere.local
Password for user administrator@vsphere.local: ********

Name                           Port  User
----                           ----  ----
192.168.5.2                    443   VSPHERE.LOCAL\Administrator

PS /home/rebelinux> 

On this example you can see that a connection to vCenter was made by using the (Get-Credential) option to request the credentials on the console. In the same way we could create a variable with preset credentials. In this example I show you how to do it.

PS /home/rebelinux> $Credenciales = Get-Credential

PowerShell credential request
Enter your credentials.
User: administrator@vsphere.local
Password for user administrator@vsphere.local: ********
PS /home/rebelinux> Connect-VIServer -Server 192.168.5.2 -Credential $Credenciales   


Name                           Port  User
----                           ----  ----
192.168.5.2                    443   VSPHERE.LOCAL\Administrator

PS /home/rebelinux> 

In the previous example the credentials are saved in a variable with the name $Credentials and then this variable is used as “Input” in the “Connect-VIServer” command using the (-Credential $Credentials) option. Once the initial connection is made you can use the variable $defaultVIServer to validate the existing connection. It is important to mention that the session found in the $defaultVIServer variable will be used by default when using the cmdlet if the “-Server” option is not specified.

PS /home/rebelinux> $defaultVIServer


Name                           Port  User
----                           ----  ----
192.168.5.2                    443   VSPHERE.LOCAL\Administrator

PS /home/rebelinux> 

By using the $defaultVIServers variable we can see all the connections previously made. As you can see in the following example multiple connections are shown where the session with the IP address “192.168.5.253” belongs to an ESXi server.

PS /home/rebelinux> $defaultVIServers                                                  


Name                           Port  User
----                           ----  ----
192.168.5.253                  443   root
192.168.5.2                    443   VSPHERE.LOCAL\Administrator

PS /home/rebelinux> 

After making the connection to our vCenter we can use any cmdlet included in PowerCLI. On the following example all VM managed by the vCenter are listed using the “Get-VM” cmdlet.

PS /home/rebelinux> Get-VM 


Name                 PowerState Num CPUs MemoryGB
----                 ---------- -------- --------
Horizon-OPM-01V      PoweredOff 4        16.000
FreeNAS              PoweredOff 2        8.000
Horizon-CS-01V       PoweredOff 2        5.000
vcenter-01v          PoweredOn  2        12.000
Horizon-APV-01V      PoweredOff 2        4.000
cluster1-03          PoweredOff 2        8.000
Horizon-CAP-01V      PoweredOff 2        4.000
horizon-tp-01v       PoweredOff 2        4.000
cluster1-04          PoweredOff 2        8.000
Horizon-LNX-01T      PoweredOff 1        2.000
Horizon-IDM-01V      PoweredOff 2        6.000
Horizon-SQL-01V      PoweredOff 2        4.000
Horizon-IDM-01V      PoweredOff 2        6.000
Horizon-RDS-01T      PoweredOff 2        4.000
Horizon-RDS-01T      PoweredOff 2        4.000
Horizon-OPM-01V      PoweredOff 4        16.000
Horizon-UAG-02V      PoweredOff 2        4.000
Horizon-UAG-01V      PoweredOff 2        4.000
horizon-tp-01v       PoweredOff 2        4.000
Management-PC        PoweredOff 2        8.000
csr-pharmax-hq       PoweredOff 1        4.000
GNS3 Server          PoweredOff 4        20.000
Server-DC-01V        PoweredOn  2        4.000
csr-pharmax-dr       PoweredOff 1        4.000

PS /home/rebelinux

If there are connections to multiple vCenter sessions all VMs of all connected vCenters will be shown. To filter the result to only a specific vCenter you can use the “-Server” option when executing the cmdlet.

PS /home/rebelinux> Get-VMHost -Server 192.168.5.2


Name                 ConnectionState PowerState NumCpu CpuUsageMhz CpuTotalMhz   MemoryUsageGB   MemoryTotalGB Version
----                 --------------- ---------- ------ ----------- -----------   -------------   ------------- -------
esxsvr-00f.pharmax.… Connected       PoweredOn       4         348       13628          17.792          63.865   7.0.3
comp-01a.pharmax.lo… NotResponding   Unknown         2           0        6816           0.000           7.995        
comp-02a.pharmax.lo… NotResponding   Unknown         2           0        6816           0.000           7.995        

PS /home/rebelinux> 

Once finished interacting with the vCenter session you can use the “Disconnect-VIServer” cmdlet to disconnect the session.

PS /home/rebelinux> Disconnect-VIServer -Server 192.168.5.2

Confirm
Are you sure you want to perform this action?
Performing the operation "Disconnect VIServer" on target "User: VSPHERE.LOCAL\Administrator, Server: 192.168.5.2, Port: 443".
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Yes"): Y
PS /home/rebelinux> 

Finally, by using the $defaultVIServers variable you can validate if the session was disconnected successfully.

PS /home/rebelinux> $defaultVIServers                      


Name                           Port  User
----                           ----  ----
192.168.5.253                  443   root

PS /home/rebelinux> 

See you later Amigos!

PowerShell – VMware PowerCLI Introduction

Hi all,

In this post we will see how to install and use the PowerCLI tool. Recently on the VMware Blog portal they conducted a survey on the top 10 most used VMware administrators’ tools. A curious fact is that the PowerCLI tool achieved the first place on the list for the year 2021. It is for this reason that I took the initiative to create a series of introduction articles on how to perform basic tasks using PowerCLI.

VMware describes PowerCLI as:

VMware PowerCLI is a command-line and scripting tool built on Windows PowerShell, and provides more than 800 cmdlets for managing and automating VMware vSphere, VMware Cloud Director, vRealize Operations Manager, vSAN, VMware NSX-T Data Center, VMware Cloud Services, VMware Cloud on AWS, VMware HCX, VMware Site Recovery Manager, and VMware Horizon environments.

VMware {Code}

As you can see PowerCLI is directly integrated into the VMware ecosystem and is the main tool for automation and development. With this tool you can create simple scripts as well as schedule or automate tasks in large physical and virtual datacenters.

To start using PowerCLI it is required to install the tool, to achieve this goal you can install it from a PowerShell console. In my case, I will be using ‘PowerShell Core’ on linux but it can be installed in the same way on Windows or Macos. To access PowerShell from Linux we use the “pwsh” command from a console or “shell”.

[rebelinux@xxxxx ~]$ pwsh
PowerShell 7.1.5
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/rebelinux>

Once you have access to the “pwsh” console you can use the “Install-Module” command to install the tool. The following example shows the result:


PS /home/rebelinux> Install-Module -Name VMware.PowerCLI                                                                                                                                                                                                                                             Installing package 'VMware.PowerCLI'
Installing dependent package 'VMware.Vim' 
Installing package 'VMware.Vim'
Downloaded 13.78 MB out of 15.25 MB.  
[ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo]
PS /home/rebelinux>                                                                                                                        

To validate which version of PowerCLI you have installed you can use the “Get-Module” command:

PS /home/rebelinux> Get-Module -ListAvailable VMware.PowerCLI

    Directory: /home/rebelinux/.local/share/powershell/Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Manifest   12.4.1.18VMware.PowerCLI                     Desk      

PS /home/rebelinux> 

Once PowerCLI is installed the administration modules can be used. To identify which commands or the so-called PowerShell cmdlets are available we can use the “Get-command” command.

PS /home/rebelinux> Get-Command -Module VMware* get-vm*     

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-VM                                             12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VmcClusterEdrsPolicy                           12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VmcOrganization                                12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VmcSddc                                        12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VmcSddcCluster                                 12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VmcSddcNetworkService                          12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VmcSddcSiteRecovery                            12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VmcSddcSiteRecoveryInstance                    12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VmcService                                     12.4.0.18… VMware.VimAutomation.Vmc
Cmdlet          Get-VMGuest                                        12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMGuestDisk                                    12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHost                                         12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostAccount                                  12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostAdvancedConfiguration                    12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostAttributes                               7.0.2.178… VMware.DeployAutomation
Cmdlet          Get-VMHostAuthentication                           12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostAvailableTimeZone                        12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostDiagnosticPartition                      12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostDisk                                     12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostDiskPartition                            12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostFirewallDefaultPolicy                    12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostFirewallException                        12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostFirmware                                 12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostHardware                                 12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostHba                                      12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostImageProfile                             7.0.2.178… VMware.DeployAutomation
Cmdlet          Get-VMHostMatchingRules                            7.0.2.178… VMware.DeployAutomation
Cmdlet          Get-VMHostModule                                   12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostNetwork                                  12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostNetworkAdapter                           12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostNetworkStack                             12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostNtpServer                                12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostPatch                                    12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostPciDevice                                12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostProfile                                  12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostProfileImageCacheConfiguration           12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostProfileRequiredInput                     12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostProfileStorageDeviceConfiguration        12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostProfileUserConfiguration                 12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostProfileVmPortGroupConfiguration          12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostRoute                                    12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostService                                  12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostSnmp                                     12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostStartPolicy                              12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostStorage                                  12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMHostSysLogServer                             12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMQuestion                                     12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMResourceConfiguration                        12.4.0.18… VMware.VimAutomation.Core
Cmdlet          Get-VMStartPolicy                                  12.4.0.18… VMware.VimAutomation.Core

PS /home/rebelinux>

In the specific case of the previous example a filter was applied to the command to show only the cmdlet starting with “get-vm*”. In the next article I will be showing you how to make the initial connection to vCenter or to a standalone ESXi server.

See you soon!

HomeLab – Active Directory Documentation using AsBuiltReport

Hello to all!

Earlier I wrote about the NetApp.Ontap report that I helped develop through the AsBuildReport project created by “Tim Carman” @tpcarman (Here the link). Well this time I will be talking about another report that I have been working on during these last months related to building documentation about the “Active Directory” (AD) infrastructure. For many years I have done several implementations and/or consultancies related to this service and I have always had the intention of creating a condensed report on how this service infrastructure was designed, which for statistical purposes runs in more than 95% of the world’s companies.

Although I have to admit that there are a number of experts who have created several similar reports, a unique feature of this report is that it uses AsBuildReport as the basis for generating the programming necessary to set up the report structure. So I as a programmer can concentrate on the technology I want to document and not on adding code to generate the formatting in Word or HTML.

This report is in an initial state and in constant development, but I decided to release it publicly to receive recommendations or rather to encourage other developers to contribute to improve its content. The development website of the report is in Github I leave the link so you can see the scope and objective of the project.

This report can only be run on Windows 10+ or Windows Server 2012+. Additionally PowerShell version 5.1 or PowerShell 7+ is required and the following modules are also required in order to generate the report:

This report uses PowerShell version 5.+ or PSCore 7, to validate the version we can use the variable “$PSVersionTable” from the PowerShell console:

PS C:\Users\jocolon> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1237
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1237
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\Users\jocolon>

To validate if the required modules are present we can use the “Get-Module” command as shown in the following example:

PS C:\Users\jocolon> Get-Module -ListAvailable -Name @('ActiveDirectory','GroupPolicy','PSPKI')

    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     3.7.2      PSPKI                               {Set-CertificateExtension, Get-CertificationAuthorityDbSch...

    Directory: C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   1.0.1.0    ActiveDirectory                     {Add-ADCentralAccessPolicyMember...
Manifest   1.0.0.0    GroupPolicy                         {Backup-GPO, Block-GPInheritance...

PS C:\Users\jocolon>

If the command does not produce any result it means that none of the modules are installed. To install these dependencies we use the “Install-Module” command:

Installation of the PSPKI module:
PS C:\WINDOWS\system32> Install-Module -Name PSPKI                                                                                                                                                                                                                                                                                Installing package 'PSPKI'                                                                                                                                                                                                                                                        Copying unzipped package to 'C:\Users\jocolon\AppData\Local\Temp\2052046370\PSPKI'                                                                                                                                                                                             [oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo]    
PS C:\WINDOWS\system32>                                                                                                                                                                                                                                                                                 

To install the “ActiveDirectory” and “GroupPolicy” modules use the command “Add-WindowsCapability” for Windows 10 or the command “Install-WindowsFeature” for Windows Server 2012+.

Installation of ActiveDirectory and GroupPolicy module:
PS C:\WINDOWS\system32> Add-WindowsCapability -online -Name 'Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0'                                                                                                                                                                                                                                                                                                                                                                                                                                                    
Path          :
Online        : True
RestartNeeded : False

PS C:\WINDOWS\system32> Add-WindowsCapability -online -Name 'Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0'

Path          :
Online        : True
RestartNeeded : False

PS C:\WINDOWS\system32>

Once we have installed the prerequisites we can proceed with the installation of the main module “AsBuiltReport.Microsoft.AD”.

PS C:\WINDOWS\system32> Install-Module -Name AsBuiltReport.Microsoft.AD

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y

    Directory: C:\Program Files\WindowsPowerShell\Modules

PS C:\WINDOWS\system32>

To validate if the module was properly installed you can use the “Get-Module” command.

PS C:\WINDOWS\system32> Get-Module -ListAvailable -Name AsBuiltReport.Microsoft.AD


    Directory: C:\Users\jocolon\Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     0.4.0      AsBuiltReport.Microsoft.AD          Invoke-AsBuiltReport.Microsoft.AD


PS C:\WINDOWS\system32>

Note: As you can see, the module “0.4.0” version was installed.

An optional requirement is to build a configuration file that allows you to set the organization’s parameters that are used to generate the report. This process will generate a JSON file that is used as a template so that you do not have to fill in repetitive information when generating reports. To view the configuration procedure, simply click on the “+” icon.

Configuration files (AsBuiltReport JSON)

The powershell cmdlet New-AsBuiltConfig allows you to generate the template that we will use as the basis of the report. This template sets the non-technical parameters of the report.

PS C:\WINDOWS\system32> New-AsBuiltConfig

---------------------------------------------
 <        As Built Report Information      >
---------------------------------------------
Enter the name of the Author for this As Built Report [jocolon]: Jonathan Colon
---------------------------------------------
 <           Company Information           >
---------------------------------------------
Would you like to enter Company information for the As Built Report? (y/n): y
Enter the Full Company Name: Zen PR Solutions
Enter the Company Short Name: ZENPR
Enter the Company Contact: Jonathan Colon
Enter the Company Email Address: jcolonf@zenprsolutions.com
Enter the Company Phone: XXX-XXX-XXXX
Enter the Company Address: Puerto Rico
---------------------------------------------
 <            Email Configuration          >
---------------------------------------------
Would you like to enter SMTP configuration? (y/n): n
----------------------------------------------
 <       As Built Report Configuration      >
----------------------------------------------
Would you like to save the As Built Report configuration file? (y/n): y
Enter a name for the As Built Report configuration file [AsBuiltReport]: HomeLab ONTAP Report
Enter the path to save the As Built Report configuration file [C:\Users\jocolon\AsBuiltReport]:

Name                           Value
----                           -----
Email                          {Port, Credentials, Server, To...}
Company                        {FullName, Contact, Phone, Email...}
UserFolder                     {Path}
Report                         {Author}


PS C:\WINDOWS\system32>

Once the process is completed, a JSON file will be created with the following content:

{
    "Email":  {
                  "Port":  null,
                  "Credentials":  null,
                  "Server":  null,
                  "To":  null,
                  "From":  null,
                  "UseSSL":  null,
                  "Body":  null
              },
    "Company":  {
                    "FullName":  "Zen PR Solutions",
                    "Contact":  "Jonathan Colon",
                    "Phone":  "787-203-2790",
                    "Email":  "jcolonf@zenprsolutions.com",
                    "ShortName":  "ZENPR",
                    "Address":  "Puerto Rico"
                },
    "UserFolder":  {
                       "Path":  "C:\\Users\\jocolon\\AsBuiltReport"
                   },
    "Report":  {
                   "Author":  "Jonathan Colon"
               }
}

The New-AsBuiltReportConfig command allows you to set the technical parameters of the report such as the level and type of information collected “verbose level”.

PS C:\WINDOWS\system32> New-AsBuiltReportConfig Microsoft.AD -FolderPath C:\Users\jocolon\AsBuiltReport\

Once the process is completed, a JSON file will be created with the following content:

{
    "Report": {
        "Name": "Microsoft AD As Built Report",
        "Version": "1.0",
        "Status": "Released",
        "ShowCoverPageImage": true,
        "ShowTableOfContents": true,
        "ShowHeaderFooter": true,
        "ShowTableCaptions": true
    },
    "Options": {

    },
    "InfoLevel": {
        "_comment_": "0 = Disabled, 1 = Enabled, 2 = Adv Summary, 3 = Detailed",
        "Forest": 1,
        "Domain": 1,
        "DHCP": 1,
        "DNS": 1,
        "CA": 0,
        "Security": 0
    },
    "HealthCheck": {
        "Domain": {
            "GMSA": true,
            "GPO": true
        },
        "DomainController": {
            "Diagnostic": true,
            "Services": true
        },
        "Site": {
            "Replication": true
        },
        "DNS": {
            "Aging": true
        },
        "DHCP": {
            "Summary": true,
            "Credential": true,
            "Statistics": true,
            "BP": true
        }
    }
}

This configuration file can be used to specify the level of detail of the report as well as which specific report sessions are to be enabled.

Then we can generate the report using the command “New-AsBuiltReport -Report Microsoft.AD -Target DC_FQDN”. It is important to emphasize that it is required that the computer where the report is generated is added to the AD domain to be documented. It is also required to use the “fully qualified domain name “(FQDN) of the server with the “Domain Controller” role within the AD “Forest”.

PS C:\Users\jocolon>  New-AsBuiltReport -Report Microsoft.AD -Target server-dc-01v.zenpr.local -Format HTML -AsBuiltConfigFilePath C:\Users\jocolon\AsBuiltReport\AsBuiltReport.json -OutputFolderPath C:\Users\jocolon\AsBuiltReport\ -ReportConfigFilePath '.\AsBuiltReport\AsBuiltReport.Microsoft.AD.json' -Credential $cred -EnableHealthCheck               

Please wait while the Microsoft AD As Built Report is being generated.
WARNING: [ 20:03:36:175 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Group Managed Service Accounts Information - ZENPR.LOCAL'.
WARNING: [ 20:03:52:062 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'AD Domain Controller Hardware Information - ZENPR.LOCAL'.
WARNING: [ 20:04:12:144 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Site Replication Information - ZENPR.LOCAL'.
WARNING: [ 20:04:12:412 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Site Replication Failure Information - ZENPR.LOCAL'.
WARNING: [ 20:05:53:997 ] [ Document ] - Error: Collecting Active Directory Group Policy Objects with Startup/Shutdown Script for domain ACAD.ZENPR.LOCAL.
WARNING: [ 20:06:21:709 ] [ Document ] - Cannot bind argument to parameter 'Rows' because it is an empty collection.
WARNING: [ 20:06:21:853 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'IPv4 Scope Failover Cofiguration Information - SERVER-DC-01V'.
WARNING: [ 20:06:22:399 ] [ Document ] - Cannot bind argument to parameter 'Rows' because it is an empty collection.
WARNING: [ 20:06:22:440 ] [ Document ] - Cannot bind argument to parameter 'Rows' because it is an empty collection.
WARNING: [ 20:06:22:525 ] [ Document ] - Cannot bind argument to parameter 'Rows' because it is an empty collection.
WARNING: [ 20:06:22:555 ] [ Document ] - Cannot bind argument to parameter 'Rows' because it is an empty collection.
WARNING: [ 20:06:22:589 ] [ Document ] - Cannot bind argument to parameter 'Rows' because it is an empty collection.
WARNING: [ 20:06:22:897 ] [ Document ] - Error: Retreiving DHCP Server IPv4 Scope Failover Setting from ACADE-DC-01V.
Microsoft AD As Built Report 'Microsoft AD As Built Report' has been saved to 'C:\Users\jocolon\AsBuiltReport\'.
PS C:\Users\jocolon>

Here is an example of the resulting Active Directory documentation.

Additionally I include several examples of how to invoke the documentation report.

# Generate a Microsoft Active Directory As Built Report for Domain Controller Server 'admin-dc-01v.contoso.local' using specified credentials. Export report to HTML & DOCX formats. Use default report style. Append timestamp to report filename. Save reports to 'C:\Users\Jon\Documents'

PS C:\> New-AsBuiltReport -Report Microsoft.AD -Target 'admin-dc-01v.contoso.local' -Username 'administrator@contoso.local' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -Timestamp

# Generate a Microsoft Active Directory As Built Report for Domain Controller Server 'admin-dc-01v.contoso.local' using specified credentials and report configuration file. Export report to Text, HTML & DOCX formats. Use default report style. Save reports to 'C:\Users\Jon\Documents'. Display verbose messages to the console.

PS C:\> New-AsBuiltReport -Report Microsoft.AD -Target 'admin-dc-01v.contoso.local' -Username 'administrator@contoso.local' -Password 'P@ssw0rd' -Format Text,Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -ReportConfigFilePath 'C:\Users\Jon\AsBuiltReport\AsBuiltReport.Microsoft.AD.json' -Verbose

# Generate a Microsoft Active Directory As Built Report for Domain Controller Server 'admin-dc-01v.contoso.local' using stored credentials. Export report to HTML & Text formats. Use default report style. Highlight environment issues within the report. Save reports to 'C:\Users\Jon\Documents'.

PS C:\> $Creds = Get-Credential
PS C:\> New-AsBuiltReport -Report Microsoft.AD -Target 'admin-dc-01v.contoso.local' -Credential $Creds -Format Html,Text -OutputFolderPath 'C:\Users\Jon\Documents' -EnableHealthCheck

# Generate a Microsoft Active Directory As Built Report for Domain Controller Server 'admin-dc-01v.contoso.local' using specified credentials. Export report to HTML & DOCX formats. Use default report style. Reports are saved to the user profile folder by default. Attach and send reports via e-mail.

PS C:\> New-AsBuiltReport -Report Microsoft.AD -Target 'admin-dc-01v.contoso.local' -Username 'administrator@contoso.local' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -SendEmail

See you later folks!

HomeLab – Automated NetApp Ontap Documentation with AsBuiltReport

Hello everyone!

This time I come to talk about a project that I have been working on for a few months. If you remember some time ago I wrote about the AsBuildReport tool specifically the module to document VMware vSphere based infrastructures see the post here. Well today I come to show you a module that I help to develop with the purpose of documenting NetApp storage devices specifically on the ONTAP operating system.

This report is in an initial state and in active development, but I decided to release it publicly in order to receive recommendations or rather to encourage other developers to contribute to improve its content. The development website of the report is in Github I leave the link so you can see the scope and objective of the project:

I should make it clear that this report is not designed to replace or compete in any way with the NetAppDocs tool. I noticed many requests on the NetApp forum from various users who have the need to generate an updated report of their storage infrastructure. It is for this reason that I took the initiative to create a report available free of charge for NetApp customers and/or users. One advantage of using the AsBuiltReport project, is that it allows you to create the report in multiple formats (Word, HTML or Text) and it is also possible to automate the sending of the report via email.

Now, to get started we need to meet the following requirements:

  • Multi-platform Windows, Linux o MAC
  • PowerShell v5.1+ ó v7
  • “NetApp PowerShell Toolkit” >= 9.9.1.2106 powershell module
  • AsBuiltReport.Core >= 1.1.0 powershell module

This report uses PowerShell version 5.+ or PSCore 7, to validate the version you can use the $PSVersionTable variable from the PowerShell shell:

PS /home/rebelinux> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.1.4
PSEdition                      Core
GitCommitId                    7.1.4
OS                             Linux 5.14.2-arch1-2 #1 SMP PREEMPT Thu, 09 Sep 2021 09:42:35 +0000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PS /home/rebelinux>

The report was created specifically for the version of “NetApp PowerShell Toolkit” >= 9.9.1.2106. To validate what version you have or if it has been installed you can use the Get-Module command as shown in the following example:

Note: Additionally I validate the version of “AsBuiltReport.Core” which is an additional dependency to be able to generate the report.

PS /home/rebelinux> Get-Module -ListAvailable -Name @('AsBuiltReport.Core','Netapp.Ontap')                                    

    Directory: /home/rebelinux/.local/share/powershell/Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     1.1.0                 AsBuiltReport.Core                  Desk      {New-AsBuiltReport, New-AsBuiltConfig}
Manifest   9.9.1.2106            NetApp.ONTAP                        Desk      Add-NaHelpInfoUri

PS /home/rebelinux>

If no result is produced it means that none of the modules are installed. The Install-Module command is used to install these dependencies:

PS /home/rebelinux> Install-Module -Name @('AsBuiltReport.Core','Netapp.Ontap')
Installing 2 modules.
Installing Module 'NetApp.ONTAP' (2 of 2).
[ooooooooooooooooooooooooooooooooooooooooooooooooooo]
Installing package 'NetApp.ONTAP'
Downloaded 1.47 MB out of 14.60 MB.
[oooooooooo                                         ]
PS /home/rebelinux>

Then proceed to install the ONTAP report using the following command:

PS /home/rebelinux> Install-Module -Name AsBuiltReport.NetApp.ONTAP
Installing 1 modules.
Installing Module 'AsBuiltReport.NetApp.ONTAP' (1 of 1).
[ooooooooooooooooooooooooooooooooooooooooooooooooooo]
Installing package 'AsBuiltReport.NetApp.ONTAP'
Downloaded 0.2 MB out of 0.88 MB.
[oooooooooo                                         ]
PS /home/rebelinux>

To validate if the installation was successful we can use the Get-Module command.

PS /home/rebelinux> Get-Module -ListAvailable "AsBuiltReport.NetApp.ONTAP" 


    Directory: C:\Program Files\WindowsPowerShell\Modules

ModuleType Version    PreRelease Name                                PSEdition ExportedCommands
---------- -------    ---------- ----                                --------- ----------------
Script     0.4.0                 AsBuiltReport.NetApp.ONTAP          Desk      Invoke-AsBuiltReport.NetApp.ONTAP

PS /home/rebelinux>

Note: As you can see, the module 0.4.0 version was installed.

An optional requirement is to generate a configuration file that allows you to set the organization parameters that are used to build the report. This process creates a JSON files that are used as templates so that you do not have to fill in repetitive information when building the reports. To view the configuration procedure, simply click on the “+” icon.

Configuration files (AsBuiltReport JSON)

The powershell cmdlet New-AsBuiltConfig allows you to build the template that will be used as the basis of the report. This template sets the non-technical parameters of the report.

PS C:\WINDOWS\system32> New-AsBuiltConfig

---------------------------------------------
 <        As Built Report Information      >
---------------------------------------------
Enter the name of the Author for this As Built Report [jocolon]: Jonathan Colon
---------------------------------------------
 <           Company Information           >
---------------------------------------------
Would you like to enter Company information for the As Built Report? (y/n): y
Enter the Full Company Name: Zen PR Solutions
Enter the Company Short Name: ZENPR
Enter the Company Contact: Jonathan Colon
Enter the Company Email Address: jcolonf@zenprsolutions.com
Enter the Company Phone: XXX-XXX-XXXX
Enter the Company Address: Puerto Rico
---------------------------------------------
 <            Email Configuration          >
---------------------------------------------
Would you like to enter SMTP configuration? (y/n): n
----------------------------------------------
 <       As Built Report Configuration      >
----------------------------------------------
Would you like to save the As Built Report configuration file? (y/n): y
Enter a name for the As Built Report configuration file [AsBuiltReport]: HomeLab ONTAP Report
Enter the path to save the As Built Report configuration file [C:\Users\jocolon\AsBuiltReport]:

Name                           Value
----                           -----
Email                          {Port, Credentials, Server, To...}
Company                        {FullName, Contact, Phone, Email...}
UserFolder                     {Path}
Report                         {Author}


PS C:\WINDOWS\system32>

Once the process is completed, a JSON file will be created with the following content:

{
    "Email":  {
                  "Port":  null,
                  "Credentials":  null,
                  "Server":  null,
                  "To":  null,
                  "From":  null,
                  "UseSSL":  null,
                  "Body":  null
              },
    "Company":  {
                    "FullName":  "Zen PR Solutions",
                    "Contact":  "Jonathan Colon",
                    "Phone":  "787-203-2790",
                    "Email":  "jcolonf@zenprsolutions.com",
                    "ShortName":  "ZENPR",
                    "Address":  "Puerto Rico"
                },
    "UserFolder":  {
                       "Path":  "C:\\Users\\jocolon\\AsBuiltReport"
                   },
    "Report":  {
                   "Author":  "Jonathan Colon"
               }
}

The New-AsBuiltReportConfig command allows you to set the technical parameters of the report such as the verbose level and type of information.

PS C:\WINDOWS\system32> New-AsBuiltReportConfig NetApp.ONTAP -FolderPath C:\Users\jocolon\AsBuiltReport\

Once the process is completed, a JSON file will be created with the following content:

{
    "Report": {
        "Name": "NetApp ONTAP As Built Report",
        "Version": "0.3.0",
        "Status": "Released",
        "ShowCoverPageImage": false,
        "ShowTableOfContents": true,
        "ShowHeaderFooter": true,
        "ShowTableCaptions": true
    },
    "Options": {

    },
    "InfoLevel": {
        "_comment_": "0 = Disabled, 1 = Enabled",
        "Cluster": 1,
        "Node": 1,
        "Storage": 1,
        "License": 1,
        "Network": 1,
        "Vserver": 1,
        "Replication": 1,
        "Efficiency": 1,
        "Security": 1,
        "System": 1
    },
    "HealthCheck": {
        "Cluster": {
            "Summary": true,
            "HA": true,
            "AutoSupport": true
        },
        "Node": {
            "HW": true,
            "ServiceProcessor": true
        },
        "Storage": {
            "Aggr": true,
            "DiskStatus": true,
            "ShelfStatus": true,
            "Efficiency": true,
            "FabricPool": true
        },
        "Network": {
            "Port": true,
            "Interface": true
        },
        "License": {
            "RiskSummary": true,
            "ServiceProcessor": true
        },
        "Vserver": {
            "Status": true,
            "Iscsi": true,
            "FCP": true,
            "NFS": true,
            "Quota": true,
            "CIFS": true,
            "Snapshot": true
        },
        "Replication": {
            "Status": true,
            "ClusterPeer": true,
            "VserverPeer": true,
            "Relationship": true,
            "History": true,
            "Mediator": true
        },
        "System": {
            "NTP": true,
            "DNS": true,
            "EMS": true,
            "Backup": true
        },
        "Security": {
            "Users": true,
            "KMS": true
    }
    }
}

Then we can build the report using the command “New-AsBuiltReport -Report NetApp.ONTAP -Target IP/FQDN”.

PS /home/rebelinux> New-AsBuiltReport -Report NetApp.ONTAP -AsBuiltConfigFilePath /home/rebelinux/script/AsBuiltReport.json -OutputFolderPath /home/rebelinux/script -Target 192.168.7.60 -Format HTML  -EnableHealthCheck -Credential $cred -ReportConfigFilePath /home/rebelinux/script/AsBuiltReport.NetApp.ONTAP.json               

WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: [ 13:17:34:209 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Vserver Lun Information - PHARMAX-HQ'.
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: [ 13:17:36:487 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Vserver Igroup Information - PHARMAX-HQ'.
WARNING: Encountered Error No 81 on volume NTAPSOL_LUN_1. Reason: Volume is offline
WARNING: [ 13:17:37:516 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Vserver NFS Service Options Summary - PHARMAX-HQ'.
WARNING: [ 13:17:49:537 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Vserver CIFS Service Information - PHARMAX-HQ'.
WARNING: [ 13:17:50:264 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Vserver CIFS Service Security Information - PHARMAX-HQ'.
WARNING: [ 13:17:51:834 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Vserver CIFS Service Options Summary - PHARMAX-HQ'.
WARNING: [ 13:17:55:913 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Replication - SnapMirror relationship Information - PHARMAX-HQ'.
WARNING: [ 13:17:56:662 ] [ Document ] - List table captions are only supported on tables with a single row. Removing caption from table 'Replication - SnapMirror Destination (List-Destinations) Information - PHARMAX-HQ'.
NetApp ONTAP As Built Report 'NetApp ONTAP As Built Report' has been saved to '/home/rebelinux/script'.
PS /home/rebelinux> 

Here is an example of the resulting report.

Additionally I include several command line examples of how to generate the report. I hope you like it!

# Generate a NetApp ONTAP As Built Report for Cluster array '192.168.7.60' using specified credentials. Export report to HTML & DOCX formats. Use default report style. Append timestamp to report filename. Save reports to 'C:\Users\Jon\Documents'

PS C:\> New-AsBuiltReport -Report NetApp.ONTAP -Target 192.168.7.60 -Username 'admin' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -Timestamp

# Generate a NetApp ONTAP As Built Report for Cluster array 192.168.7.60 using specified credentials and report configuration file. Export report to Text, HTML & DOCX formats. Use default report style. Save reports to 'C:\Users\Jon\Documents'. Display verbose messages to the console.

PS C:\> New-AsBuiltReport -Report NetApp.ONTAP -Target 192.168.7.60 -Username 'admin' -Password 'P@ssw0rd' -Format Text,Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -ReportConfigFilePath 'C:\Users\Jon\AsBuiltReport\AsBuiltReport.NetApp.ONTAP.json' -Verbose

# Generate a NetApp ONTAP As Built Report for Cluster array 192.168.7.60 using stored credentials. Export report to HTML & Text formats. Use default report style. Highlight environment issues within the report. Save reports to 'C:\Users\Jon\Documents'.

PS C:\> $Creds = Get-Credential
PS C:\> New-AsBuiltReport -Report NetApp.ONTAP -Target 192.168.7.60 -Credential $Creds -Format Html,Text -OutputFolderPath 'C:\Users\Jon\Documents' -EnableHealthCheck

# Generate a NetApp ONTAP As Built Report for Cluster array 192.168.7.60 using stored credentials. Export report to HTML & DOCX formats. Use default report style. Reports are saved to the user profile folder by default. Attach and send reports via e-mail.

PS C:\> New-AsBuiltReport -Report NetApp.ONTAP -Target 192.168.7.60 -Username 'admin' -Password 'P@ssw0rd' -Format Html,Word -OutputFolderPath 'C:\Users\Jon\Documents' -SendEmail

See you later Friends!

HomeLab – vDiagram Draw your Virtual Infrastructure

Hello everyone

Taking as a reference the Top 10 VMware Admin Tools” list, this time I am going to show you how to use the vDiagram tool that has the #6 position in the list of the most used tools by VMware infrastructure administrators. In essence this Powershell script captures and draws a VMware vSphere infrastructure using Microsoft Visio. Originally this tool was created by Alan Renouf @alanrenouf and currently the project is maintained by Tony Gonzalez @vDiagram_Tony.

To use this tool, the following requirements must be met:

  1. Powershell >= 5.1
  2. PowerCLI module (“Install-Module -Name VMware.PowerCLI”)
  3. Microsoft Visio 2013+

Once all the requirements are fulfilled, proceed to download the Powershell code. To download the application, click on the following link:

https://github.com/Tony-SouthFLVMUG/vDiagram2.0

Once the package is downloaded proceed to unpack the contents.

PS C:\> Expand-Archive -LiteralPath .\vDiagram2.0-master.zip -DestinationPath .
PS C:\> ls vD*


    Directory: C:\Users\jocolon\Downloads


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         8/26/2021  11:15 AM                vDiagram2.0-master
-a----         7/21/2021   9:37 AM       12470234 vDiagram2.0-master.zip


PS C:\>

Move to the unzipped folder and validate the content with the “ls” or “dir” command.

PS C:\> cd .\vDiagram2.0-master\
PS C:\vDiagram2.0-master> ls


    Directory: C:\vDiagram2.0-master


Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d-----         2/15/2021   5:29 PM                archived
-a----         2/15/2021   5:29 PM             66 .gitattributes
-a----         2/15/2021   5:29 PM           5771 README.md
-a----         2/15/2021   5:29 PM         109288 vDiagram.ico
-a----         2/15/2021   5:29 PM         673926 vDiagram_2.0.11.ps1
-a----         2/15/2021   5:29 PM         985128 vDiagram_2.0.11.vssx
-a----         2/15/2021   5:29 PM         116398 vDiagram_Scheduled_Task_2.0.11.ps1
-a----         2/15/2021   5:29 PM         254037 vDiagram_Standard.png


PS C:\vDiagram2.0-master>

Use the “Unblock-File” command that allows us to execute files that have been downloaded from the Internet.

PS C:\vDiagram2.0-master> Unblock-File .\vDiagram_2.0.11.ps1
PS C:\vDiagram2.0-master>

In this step with the “$PSVersionTable” command confirm the Powershell version locally installed. Reviewing the requirements section above you can see that in order to use the vDiagram tool you need to have a Powershell version 5.1.x or higher. In the example below you can see that my computer has version “5.1.19041.1151”.

PS C:\vDiagram2.0-master> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1151
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1151
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\vDiagram2.0-master>

Additionally you must validate the PowerCLI module. With the “Get-Module” command you can validate the PowerCLI installed version.

PS C:\vDiagram2.0-master> Get-Module -ListAvailable -Name 'VMware.PowerCLI' | Sort-Object -Property Version -Descending | Select-Object -First 1


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Manifest   12.3.0.... VMware.PowerCLI


PS C:\vDiagram2.0-master> 

After all requirements are met you can run the script by calling file “.\vDiagram_2.0.11.ps1”.

PS C:\vDiagram2.0-master> 

PS C:\vDiagram2.0-master> .\vDiagram_2.0.11.ps1
[08/24/2021 10:45:16] VMware PowerCLI Module(s) 12.3.0.17860403 11.5.0.14912921  found on this machine.

Once the program finishes running you can see in the “Prerequisites” tab a summary of all the dependencies and their status. In the below example all dependencies are shown in green color, which indicates that they are installed.

Following the steps as shown in the “Directions” tab, it is necessary to enter the IP/FQDN address of the vCenter and the credentials. It is important to mention that a read only account is the only needed privileges needed to connect and extract the required information.

Once the vCenter information is filled in, proceed to validate the connection by pressing the “Connect to vCenter” button. As you can see in the below image the button changes to green indicating that there was a successful connection to vCenter with the provided credentials.

The next step would be to select the “Capture CSVs for Visio” tab and specify the folder where the reports will be saved. In the below example I used the <Desktop/Output> folder.

It is important to mention that for each selected value a file will be created with the information of the respective element.

Then proceed to Click on “Collect CSV Data” to start the data collection process.

Once the data collection process ends, select the “Draw Visio” tab and configure the “Select CSV Input Folder” option.

Next, the folder where the previously collected data was stored is selected. In the following example it would be the <Desktop/Output> folder that I used in the “Capture CSVs for Visio” section.

It is now important to verify that all the information needed to build the diagram has been provided by clicking on the “CSV Validation Complete” button.

In the following step it is required to specify a folder where the diagram will be saved once it has been generated. To do so, click on “Select Visio output folder” and then select the folder to be used for this purpose. In the following example I have selected <Desktop/Output>.

In the “Visio Output Folder” area select the multiple options available to generate the diagram. Once you have selected the “Output” folder you can generate the diagram by clicking on the “Draw Visio” button.

At this step click “OK” in the notification about the diagram creation.

To view the generated diagram of our virtual infrastructure, click on the “Open Visio Diagram” button.

Finally, here are some sample images of the diagrams generated using my “HomeLab” virtual infrastructure as an example.

Summary

IIn this lab a tool called vDiagram is demonstrated, which allows us to make a logical representation of how the components of our virtual infrastructure are related. The good thing about this tool is that it is available for free. I hope you liked this lab. If you have any doubts or questions about this lab, leave them in the comments. Hasta Luego!!!!

VMware Skyline Health Diagnostics Deployment

Hello everyone

This time I come to show you the integration of “VMware Skyline Health Diagnostics” (VSHD) with VMware vCenter. I will also show you how to run the diagnostics to know how is the health of your Virtual infrastructure. VSHD is a self-diagnostic platform that allows to detect and solve problems in both vSphere and vSAN product line.

This tool provides recommendations in the form of Knowledge Base articles or links to troubleshooting procedures. vSphere administrators can use this tool to troubleshoot issues before contacting VMware Global Support.

© 2021 VMware

Benefits:

  • Based on symptoms, according to VMware VSHD automatically provides links to articles with steps to resolve the problem.
  • Self-service improves the time to get recommendations to assist in problem resolution.
  • Rapid repair to help recover the infrastructure from a failure and ensure that the business operates with less disruption.

To start we must access the following link where we can download the OVA file that allows us to manage the creation of the virtual machine where the VSHD services run.

https://my.vmware.com/group/vmware/get-download?downloadGroup=SKYLINE_HD_VSPHERE

Once authenticated on the VMware portal you will be redirected to the area where you can download the file OVA.

Below is the process of creating the VM using the OVA template that you downloaded. To see the content, just click on the “+” icon.

Installing VSHD through VMware vCenter

Start by using the “Deploy OVF Template” wizard where you upload the installation file by pressing “UPLOAD FILES”.

Set a name and select the folder in which the VM object will be created.

Select the “Compute Cluster” and press “NEXT”.

Confirm the information and press “NEXT”.

Accept the Licensing Agreement and press “NEXT”.

Select the storage location where the VM will be created and press “NEXT”.

Select the network to be used by the VM and press “NEXT”.

At this stage the unique properties of the VM such as the hostname, the password of the administration accounts and the IP address information are defined.

After the information has been validated, click “FINISH” to complete the process.

The installation process can be monitored from the “Recent Tasks” tab.

An optional requirement is the association of a DNS name to the IP used in the installation process. In the following screen we can see how to register a DNS name “FQDN” using Powershell from a Windows console

Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\Administrator> Add-DnsServerResourceRecordA -Name vmware-shd -IPv4Address 192.168.5.70 -ZoneName zenprsolutions.local -CreatePtr -AllowUpdateAny

PS C:\Users\Administrator> Get-DnsServerResourceRecord -Name vmware-shd -ZoneName zenprsolutions.local

HostName                  RecordType Type       Timestamp            TimeToLive      RecordData
--------                  ---------- ----       ---------            ----------      ----------
vmware-shd                A          1          0                    01:00:00        192.168.5.70


PS C:\Users\Administrator>

Once the OVA file installation process is complete, you can proceed to power on the VM that will be used for the VSHD service.

When we turn on the VM we can see the DNS name information and the IP address that we previously configured.

With the IP address we can access the administration portal of the application using the following credentials:

  • Username: shd-admin
  • Password: <previously established>

The next step is to add the vCenter/ESXi information and corresponding credentials.

We can validate that the information entered is correct by pressing the “CHECK CONNECTION” button.

After validating the information and credentials, you proceed to run the diagnostic by pressing “RUN DIAGNOSTIC”.

In this screen we select the ESXi and vCenter servers you wish to scan and what type of plug-in to run during the collection of diagnostic information.

Optionally you can set up a “Tag” that can be used for an easy search of the diagnostics. Then you can click on “FINISH”.

In this next image we can see the progress of the diagnostic information gathering.

Additionally from the vCenter management console you can see a task related to the gathering process.

Once the process has finished you can view the status of the task by clicking on the “SHOW SUMMARY” button.

In this screen we can see that the tasks were executed without problems.

By pressing the “SHOW REPORT” button you can view the resulting reports.

To view the report press the eye icon as shown in the following image.

Here I show you several examples of the resulting report where you can pinpoint some of the problems with the infrastructure used as an example.

Summary

In this lab, I installed and configured the “VMware Skyline Health Diagnostics” (VSHD) which allows vSphere administrators to use this tool to troubleshoot issues before contacting VMware support. One nice thing about this tool is that it is freely available. I hope you liked this lab. If you have any doubts or questions about this lab, leave them in the comments. Regards.

NetApp Ontap Mediator Installation and Configuration

Hello everyone,

Today I will be talking a bit about how to install and configure the “Ontap Mediator” application that is used as an alternate way to validate the health status of a cluster collection. To set up the role of this application I will use as reference the NetApp portal documentation:

ONTAP Mediator provides an alternate health path to the peer cluster, with the intercluster LIFs providing the other health path. With the Mediator’s health information, clusters can differentiate between intercluster LIF failure and site failure. When the site goes down, Mediator passes on the health information to the peer cluster on demand, facilitating the peer cluster to fail over. With the Mediator-provided information and the intercluster LIF health check information, ONTAP determines whether to perform an auto failover, if it is failover incapable, continue or stop.

Role of ONTAP Mediator

This application can be used in “MetroCluster” scenarios as well as with “SnapMirror Business Continuity” (SM-BC) technology. As of ONTAP 9.8, SnapMirror Business Continuity (SM-BC) can be used to protect applications with LUNs, allowing applications to migrate transparently, ensuring business continuity in the event of a disaster. SM-BC uses “SnapMirror Synchronous” technology that allows data to be replicated to the target as soon as it is written to the source volume.

In this lab I will show you the Mediator application with the purpose of being able to perform in the future a lab on SM-BC in a VMware environment. The following image shows the role of Ontap Mediator within the SM-BC technology architecture.

As you can see the “Mediator” is constantly evaluating the Datacenter status to identify possible failures and to be able to react by migrating access to the volumes to the Datacenter that is up and running. It may be useful to understand some of the basics of SM-BC recovery and restoration.

Planned recovery:

A manual operation to change the access roles to volumes in an SM-BC relationship. The primary becomes the secondary and the secondary becomes the primary. The ALUA status report is also modified according to the status of the relationship.

Automatic unplanned recovery (AUFO):

An automatic operation to perform a failover to the mirror copy. The operation requires the assistance of the Ontap Mediator to detect that the primary copy is not available.

Here are the requirements to install the application. To view the content, just click on the “+” icon.

Requirements

To validate the complete list of requirements you can visit the documentation of “Ontap Mediator”

For this lab I am going to use Red Hat Enterprise Linux 8.1 running on a vSphere VM. The first thing to do is to download the application installation package. This is done by accessing the NetApp support portal as shown in the following image.

Link to Ontap Mediator:

https://mysupport.netapp.com/site/products/all/details/ontap-mediator/downloads-tab

After downloading the installation package, copy the “ONTAP-MEDIATOR-1.3” file to the server to be used for this purpose. Then proceed to change the installation file to executable mode with the command chmod +x.

[root@NTAPMED-01V ~]# ls
anaconda-ks.cfg  ONTAP-MEDIATOR-1.3
[root@NTAPMED-01V ~]# chmod +x ONTAP-MEDIATOR-1.3 
[root@NTAPMED-01V ~]#

Next, proceed to install the application dependencies with the yum install command as shown below.

[root@NTAPMED-01V ~]# yum install openssl openssl-devel kernel-devel gcc libselinux-utils make redhat-lsb-core patch bzip2 python36 python36-devel perl-Data-Dumper perl-ExtUtils-MakeMaker python3-pip elfutils-libelf-devel policycoreutils-python-utils -y
Last metadata expiration check: 0:13:59 ago on Tue 29 Jun 2021 10:01:36 PM AST.
Package openssl-1:1.1.1g-15.el8_3.x86_64 is already installed.
Package libselinux-utils-2.9-5.el8.x86_64 is already installed.
Dependencies resolved.
...............
Installed:

Really long Output                                                              

Complete!
[root@NTAPMED-01V ~]#

Once all dependencies are installed, you can start running the application installation file. To do this use the command ./ONTAP-MEDIATOR-1.3.

Note: This command must be executed in the location where the installation file was stored.

[root@NTAPMED-01V ~]# ./ONTAP-MEDIATOR-1.3 

ONTAP Mediator: Self Extracting Installer

ONTAP Mediator requires two user accounts. One for the service (netapp), and one for use by ONTAP to the mediator API (mediatoradmin).
Would you like to use the default account names: netapp + mediatoradmin? (Y(es)/n(o)): Yes
Enter ONTAP Mediator user account (mediatoradmin) password: XXXXXX 

Re-Enter ONTAP Mediator user account (mediatoradmin) password: XXXXX

Checking if SELinux is in enforcing mode
SELinux is set to Enforcing. ONTAP Mediator server requires modifying the SELinux context of the file
/opt/netapp/lib/ontap_mediator/pyenv/bin/uwsgi from type 'lib_t' to 'bin_t'.
This is neccessary to start the ONTAP Mediator service while SELinux is set to Enforcing.
Allow SELinux context change?  Y(es)/n(o): Yes
The installer will change the SELinux context type of
/opt/netapp/lib/ontap_mediator/pyenv/bin/uwsgi from type 'lib_t' to 'bin_t'.




Checking for default Linux firewall
Linux firewall is running. Open ports 31784 and 3260? Y(es)/n(o): Yes
success
success
success


###############################################################
Preparing for installation of ONTAP Mediator packages.


Do you wish to continue? Y(es)/n(o): 

The installer will ask several questions about the password of the users used by the ONTAP Mediator service and the TCP ports that will be opened in the local “Firewall” of the server. Once everything is properly specified the installer will validate that all the application prerequisites are installed.

Do you wish to continue? Y(es)/n(o): Y


+ Installing required packages.


Updating Subscription Management repositories.

Really long Output                                                              

Dependencies resolved.
Nothing to do.
Complete!
OS package installations finished
+ Installing ONTAP Mediator. (Log: /tmp/ontap_mediator.7atkl8/ontap-mediator/install_20210709162016.log)
    This step will take several minutes. Use the log file to view progress.
#includedir /etc/sudoers.d
Sudo include verified
ONTAP Mediator logging enabled
+ Install successful. (Moving log to /opt/netapp/lib/ontap_mediator/log/install_20210709162016.log)
+ Note: ONTAP Mediator uses a kernel module compiled specifically for the current
        system OS. Using 'yum update' to upgrade the kernel may cause a service
        interruption.
    For more information, see /opt/netapp/lib/ontap_mediator/README
[root@NTAPMED-01V ~]#

After installing the application it is important to validate that the services of the Ontap Mediator are activated and functional. To validate the services use the command <systemctl status ontap_mediator mediator-scst>.

[root@NTAPMED-01V ~]# systemctl status ontap_mediator mediator-scst
 ontap_mediator.service - ONTAP Mediator
   Loaded: loaded (/etc/systemd/system/ontap_mediator.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-07-09 14:21:31 AST; 11min ago
  Process: 1296 ExecStop=/bin/kill -s INT $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 1298 (uwsgi)
   Status: "uWSGI is ready"
    Tasks: 3 (limit: 23832)
   Memory: 61.4M
 Started ONTAP Mediator.

 mediator-scst.service
   Loaded: loaded (/etc/systemd/system/mediator-scst.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-07-09 14:21:30 AST; 11min ago
  Process: 1164 ExecStart=/etc/init.d/scst start (code=exited, status=0/SUCCESS)
 Main PID: 1250 (iscsi-scstd)
    Tasks: 1 (limit: 23832)
   Memory: 3.3M
 Started mediator-scst.service.
[root@NTAPMED-01V ~]# 

Additionally, it is important to ensure that the services are using the correct tcp ports. With the command <netstat -anlt | grep -E ‘3260|31784’> you can validate that ports 3260 and 31784 are in “LISTEN” mode.

[root@NTAPMED-01V ~]# netstat -anlt | grep -E '3260|31784'
tcp        0      0 0.0.0.0:3260            0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:31784           0.0.0.0:*               LISTEN     
tcp6       0      0 :::3260                 :::*                    LISTEN     
[root@NTAPMED-01V ~]# 

With the command firewall-cmd –list-all you can validate that the rules for ports 31784/tcp and 3260/tcp are properly configured in the server’s local firewall.

[root@NTAPMED-01V ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens192
  sources: 
  services: cockpit dhcpv6-client ssh
  ports: 31784/tcp 3260/tcp
  protocols: 
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
	
[root@NTAPMED-01V ~]# 

Once the installation process has been successfully completed, add the Ontap Mediator to the configuration of the clusters where you have selected to use the “SnapMirror Business Continuity” (SM-BC) technology. To add the configuration, go to [Protection] => [Overview] => [Mediator] => [Configure]. Then you have to add the configuration as shown in the following images. It is important to mention that the certificate to be added in this configuration is the one of the CA located in:

/opt/netapp/lib/ontap_mediator/ontap_mediator/server_config/ca.crt

Note: It is important to mention that for this configuration to work there must be a “cluster peer” and “vserver peer” relationship previously established.

Through the Ontap console you can also validate that the Ontap Mediator configuration is working correctly. With the <snapmirror mediator show> command you can validate that the Connection Status is “connected” and the Quorum Status is “true”.

Note: This command must be used in both clusters to validate that the connection is correctly established.

OnPrem-HQ::> snapmirror mediator show                    
Mediator Address Peer Cluster     Connection Status Quorum Status
---------------- ---------------- ----------------- -------------
192.168.6.16     OnPrem-DR       connected         true

OnPrem-HQ::*> 
OnPrem-DR::> snapmirror mediator show
Mediator Address Peer Cluster     Connection Status Quorum Status
---------------- ---------------- ----------------- -------------
192.168.6.16     OnPrem-HQ       connected       true

OnPrem-DR::> 

Here is how to add the Ontap Mediator to the cluster through Ontap’s console. To see the content, just click on the “+” icon.

Ontap Mediator CLI Setup

With the snapmirror mediator add command you can add the Ontap Mediator with the IP address 192.168.6.16 to the Onprem-HQ cluster. It is important to mention that for this configuration to work there must be a “Cluster peer” and “Vserver peer” relationship previously established.

OnPrem-HQ::> snapmirror mediator add -mediator-address 192.168.7.167 -peer-cluster OnPrem-DR -username mediatoradmin 

Notice: Enter the mediator password.

Enter the password: XXXXX
Enter the password again: XXXXX

Info: [Job: 171] 'mediator add' job queued 

OnPrem-HQ::> 

With the snapmirror mediator show command you can validate that the Connection Status is “connected” and the Quorum Status is set to “true”.

OnPrem-HQ::> snapmirror mediator show                    
Mediator Address Peer Cluster     Connection Status Quorum Status
---------------- ---------------- ----------------- -------------
192.168.6.16     OnPrem-DR       connected         true

OnPrem-HQ::*> 
OnPrem-DR::> snapmirror mediator show
Mediator Address Peer Cluster     Connection Status Quorum Status
---------------- ---------------- ----------------- -------------
192.168.6.16     OnPrem-HQ       connected       true

OnPrem-DR::> 

Additionally I show you how to replace the SSL certificate of the Ontap Mediator service with one generated from a Microsoft Certificate Authority. To see the content, just click on the “+” icon.

Optional SSL Certificate Replacement

Step 1: Generate a configuration file to create the Certificate Signing Request (CSR). In this step it is important to set the CN and DNS with the fully qualified domain name (FQDN) of the server name. In my case the server name is NTAPMED-01V.

[root@NTAPMED-01V ~]# nano -w req.conf 
[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
prompt = no
[req_distinguished_name]
C = US
ST = PR
L = SJ
O = Zen PR Solutions
OU = IT
CN = NTAPMED-01V
[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names
[alt_names]
DNS.1 = NTAPMED-01V.zenprsolutions.local

Step 2: Use the openssl command to generate the CSR file that will be used as a template to create the certificate that the Ontap Mediator service will use.

Note: If the openssl command is not available on your system you can use the yum install openssl command to install the necessary packages

[root@NTAPMED-01V ~]# openssl req -new -out ntapmed.csr -newkey rsa:2048 -nodes -sha256 -keyout ntapmed.key -config req.conf

Once the openssl command has finished, two files will be created, the ntapmed.csr is the template that will be used to generate the certificate and the ntapmed.key is the private key.

[root@NTAPMED-01V ~]# ls -al ntapmed.*
-rw-r--r-- 1 root      root      1123 Jul  9 16:53 ntapmed.csr #Certificate Signing Request
-rw-r--r-- 1 rebelinux rebelinux 1704 Jul  9 16:53 ntapmed.key #Private Key
[root@rebelpc rebelinux]# 

Step 3: Access Microsoft’s Certificate Authority server and use the certreq.exe command to generate the certificate using the ntapmed.csr file as template.

C:\>certreq.exe -submit -attrib "CertificateTemplate:WebServer" ntapmed.csr ntapmed.cer

Once the process is completed, a file will be created with the name ntapmed.cer that is used for the Ontap Mediator service.

Step 4: To replace the SSL certificate it is also necessary to change the public certificate of the CA. To obtain this certificate from the CA use the command certutil -ca.cert ca.cert which will produce the certificate in the ca.cer file.

C:\>certutil -ca.cert ca.cer

Once this process is completed simply copy all the files (ca.cer, ntapmed.cer and ntapmed.key) to the Ontap Mediator server.

Step 5: Move to the /opt/netapp/lib/ontap_mediator/ontap_mediator/server_config/ folder and modify the certificate files as shown below.

[root@NTAPMED-01V ~]# cd /opt/netapp/lib/ontap_mediator/ontap_mediator/server_config/
[root@NTAPMED-01V server_config]# ls
ca.crt  ca.srl            config.pyc    logging.conf.yaml  ontap_mediator.config.yaml     ontap_mediator_schema.yaml  ontap_mediator_server.csr  ontap_mediator.user_config.yaml
ca.key  config_migration  __init__.pyc  netapp_sudoers     ontap_mediator.constants.yaml  ontap_mediator_server.crt   ontap_mediator_server.key
[root@NTAPMED-01V server_config]# cp -R /opt/netapp/lib/ontap_mediator/ontap_mediator/server_config /root/
[root@NTAPMED-01V server_config]#
[root@NTAPMED-01V server_config]# nano -w ca.crt
[root@NTAPMED-01V server_config]# openssl x509 -noout -serial -in ca.crt 
serial=5D2E25D9AFFDE4904A05D70BEB7ACBD2
[root@NTAPMED-01V server_config]# 
[root@NTAPMED-01V server_config]# nano -w ontap_mediator_server.crt
[root@NTAPMED-01V server_config]# nano -w ontap_mediator_server.key

After making the changes, it is necessary to restart the services using the command systemctl restart ontap_mediator mediator-scst

[root@NTAPMED-01V server_config]# systemctl restart ontap_mediator mediator-scst
[root@NTAPMED-01V server_config]# systemctl status ontap_mediator mediator-scst
 ontap_mediator.service - ONTAP Mediator
   Loaded: loaded (/etc/systemd/system/ontap_mediator.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-07-09 20:31:48 AST; 8s ago
  Process: 22222 ExecStop=/bin/kill -s INT $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 22232 (uwsgi)
   Status: "uWSGI is ready"
    Tasks: 3 (limit: 23832)
   Memory: 56.5M

 mediator-scst.service
   Loaded: loaded (/etc/systemd/system/mediator-scst.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-07-09 20:31:50 AST; 5s ago
  Process: 22223 ExecStop=/etc/init.d/scst stop (code=exited, status=0/SUCCESS)
  Process: 22309 ExecStart=/etc/init.d/scst start (code=exited, status=0/SUCCESS)
 Main PID: 22389 (iscsi-scstd)
    Tasks: 1 (limit: 23832)
   Memory: 1.0M

Summary

In this lab I showed you how to install and configure Ontap Mediator. In the future I will use this service to do a lab on “SnapMirror Business Continuity” (SM-BC) together with VMware. I hope you liked this lab. If you have any doubts or questions about it, leave them in the comments. Regards.

HomeLab: How to obtain a Veeam Not for Resale (NFR) license for your HomeLab protection

In this opportunity I come to show you how to get free Veeam licenses that you can use to protect your “HomeLab” or can be used to practice if you are planning to get certified as a “Veeam Certified Engineer” (VMCE). I am currently protecting my virtual environment with these licenses that can be obtained if you meet one of these requirements:

Who is eligible?

  • Veeam Certified Engineers (VMCE)
  • VMware: vExperts, VMware Certified Professionals (VCPs & VCAPs)
  • Microsoft: Most Valuable Professionals (MVPs), Microsoft Certified Solutions Experts (MCSEs)
  • AWS: AWS Heroes & Certified Professionals
  • Nutanix AHV: ALL Nutanix technical personnel
  • VMware, Microsoft, AWS trainers, bloggers and other certified professionals

To request this free license just access the link “Veeam FREE NFR Key for Veeam Availability Suite” and fill out the form which is shown in the following image:

After filling out the form, you will receive an email with the attached NFR licenses that you can install on your Veeam B&R Server.

Although there is a “Veeam Community” version that is also freely available, this license does not have all the features of the NFR edition. I have included the link of the Veeam portal where you can compare the features available for each type of edition. Here is the link “Veeam Feature comparison”.

I hope you liked this post. If you have any questions or comments about it, leave them in comments. Regards.

Hasta Luego Amigos!

HomeLab: Using vCheck for vSphere Infrastructure Health Accessment

In this opportunity I come to show you how to download and use the vCheck tool that is used to validate the health status of the VMware vSphere infrastructure. This tool is developed by Alan Renouf as a mechanism to identify possible failures or misconfiguration in the vSphere implementation. To learn more about this tool I will use the vCheck documentation as a reference:

This script picks on the key known issues and potential issues scripted as plugins for various technologies written as Powershell scripts and reports it all in one place so all you do in the morning is check your email.

vCheck Github Page

In this area I present to you what is checked when using vCheck. To view the content, just click on the “+” icon.

What is checked in the vSphere version?

  • General Details
  • Number of Hosts
  • Number of VMs
  • Number of Templates
  • Number of Clusters
  • Number of Datastores
  • Number of Active VMs
  • Number of Inactive VMs
  • Number of DRS Migrations for the last days
  • Snapshots over x Days old
  • Datastores with less than x% free space
  • VMs created over the last x days
  • VMs removed over the last x days
  • VMs with No Tools
  • VMs with CD-Roms connected
  • VMs with Floppy Drives Connected
  • VMs with CPU ready over x%
  • VMs with over x amount of vCPUs
  • List of DRS Migrations
  • Hosts in Maintenance Mode
  • Hosts in disconnected state
  • NTP Server check for a given NTP Name
  • NTP Service check
  • vmkernel warning messages ov the last x days
  • VC Error Events over the last x days
  • VC Windows Event Log Errors for the last x days with VMware in the details
  • VC VMware Service details
  • VMs stored on datastores attached to only one host
  • VM active alerts
  • Cluster Active Alerts
  • If HA Cluster is set to use host datastore for swapfile, check the host has a swapfile location set
  • Host active Alerts
  • Dead SCSI Luns
  • VMs with over x amount of vCPUs
  • vSphere check: Slot Sizes
  • vSphere check: Outdated VM Hardware (Less than V7)
  • VMs in Inconsistent folders (the name of the folder is not the same as the name)
  • VMs with high CPU usage
  • Guest disk size check
  • Host over committing memory check
  • VM Swap and Ballooning
  • ESXi hosts without Lockdown enabled
  • ESXi hosts with unsupported mode enabled
  • General Capacity information based on CPU/MEM usage of the VMs
  • vSwitch free ports
  • Disk over commit check
  • Host configuration issues
  • VCB Garbage (left snapshots)
  • HA VM restarts and resets
  • Inaccessible VMs

It is important to mention that vCheck has support for other products as shown in the following image:

Source: Virtu-Al.Net

To get started you need to download the tool from the Github portal where it is continuously developed. To download vCheck directly click on the following link “Download”. Once the script is downloaded, it is necessary to unzip it.

The first time vCheck is run it will start the configuration process, this configuration allows you to create a template with the information that will be used for all future runs of the program. To modify these parameters again you can use the <-config> option as follows:

[blabla@blabla ~]$ pwsh #Powershell core on Linux :)
PowerShell 7.1.3
Copyright (c) Microsoft Corporation.

https://aka.ms/powershell
Type 'help' to get help.

PS /home/blabla/vCheck> ./vCheck.ps1 -config

In this area I demonstrate the vCheck configuration process. To see the configuration process, just click on the “+” icon.

Configuration process example

PS /home/blabla/vCheck> ./vCheck.ps1 -config
WARNING: 
GlobalVariables
# Report header [vCheck]: 
# Would you like the report displayed in the local browser once completed ? [$true]: 
# Display the report even if it is empty? [$true]: 
# Use the following item to define if an email report should be sent once completed [$false]: 
# Please Specify the SMTP server address (and optional port) [servername(:port)] [mysmtpserver.mydomain.local]: 
# Would you like to use SSL to send email? [$false]: 
# Please specify the email address who will send the vCheck report [me@mydomain.local]: 
# Please specify the email address(es) who will receive the vCheck report (separate multiple addresses with comma) [me@mydomain.local]: 
# Please specify the email address(es) who will be CCd to receive the vCheck report (separate multiple addresses with comma) []: 
# Please specify an email subject [$Server vCheck Report]: 
# Send the report by e-mail even if it is empty? [$true]: 
# If you would prefer the HTML file as an attachment then enable the following: [$false]: 
# Set the style template to use. [Clarity]: 
# Do you want to include plugin details in the report? [$true]: 
# List Enabled plugins first in Plugin Report? [$true]: 
# Set the following setting to $true to see how long each Plugin takes to run as part of the report [$true]: 
# Report on plugins that take longer than the following amount of seconds [30]: 
WARNING: 
Connection settings for vCenter
# Please Specify the address (and optional port) of the vCenter server to connect to [servername(:port)] [vcsa.local.lab]: vcenter-01v.pharmax.local
WARNING: 
General Information
# Set the number of days of DRS Migrations to report and count on [1]: 
# Set the number of days of Storage DRS Migrations to report and count on [1]: 
WARNING: 
Checking VI Events
# Set the number of days of VC Events to check for errors [1]: 
WARNING: 
Windows vCenter Error Event Logs
# Set the number of days of VC Events to check for errors [1]: 
# Set the number of days of VC Event Logs to check for warnings and errors [1]: 
WARNING: 
Windows vCenter Error Event Logs
# Set the number of days of VC Events to check for errors [1]: 
# Set the number of days of VC Event Logs to check for warnings and errors [1]: 
WARNING: 
vCenter Sessions Age
# Enter maximum vCenter session length in hours [48]: 
# Enter minimum vCenter session length in minutes (IdleMinutes) [10]: 
# Do not report on usernames that are defined here (regex) [DOMAIN\\user1|DOMAIN\\user2]: 
WARNING: 
vCenter License Report
# Display Eval licenses? [$true]: 
WARNING: 
HA configuration issues
# HA Configuration Issues, do not report on any Clusters that are defined here [Example_Cluster_*|Test_Cluster_*]: 
# HA should be set to ... [$true]: 
# HA host monitoring should be set to ... [$true]: 
# HA Admission Control should be set to ... [$true]: 
WARNING: 
HA VMs restarted
# HA VM restart day(s) number [5]: 
WARNING: 
DRS & SDRS Migrations
# Set the number of days of DRS Migrations to report and count on [1]: 
# Set the number of days of Storage DRS Migrations to report and count on [1]: 
WARNING: 
Cluster Slot Sizes
# Minimum number of slots available in a cluster [10]: 
WARNING: 
Datastore Consistency
# Do not report on any Datastores that are defined here (Datastore Consistency Plugin) [local*|datastore*]: 
WARNING: 
Clusters with DRS disabled
# Clusters with DRS Disabled, do not report on any Clusters that are defined here [VM1_*|VM2_*]: 
WARNING: 
QuickStats Capacity Planning
# Max CPU usage for non HA cluster [0.6]: 
# Max MEM usage for non HA cluster [0.6]: 
WARNING: 
s/vMotion Information
# Set the number of days to go back and check for s/vMotions [5]: 
# Include vMotions in report [$true;]: 
# Include Storage vMotions in report [$true;]: 
WARNING: 
DRS Rules
# Display VM affinity rules? [$true]: 
# Display VM anti-affinity rules? [$true]: 
# Display HOSTaffinity rules? [$true]: 
# Set DRS Rule name exception (regex) [ExcludeMe]: 
WARNING: 
Hosts Overcommit state
# Return results in GB or MB? [GB]: 
WARNING: 
Active Directory Authentication
# Show "OK" results? [$false]: 
# Expected Domain name [mydomain.local]: 
# Expected Admin Group [ESX Admins]: 
WARNING: 
NTP Name and Service
# The NTP server which should be set on your hosts (comma-separated) [pool.ntp.org,pool2.ntp.org]: 
WARNING: 
VMKernel Warnings
# Disabling displaying Google/KB links in order to have wider message column [$true]: 
WARNING: 
Syslog Name
# The Syslog server(s) which should be set on your hosts (comma-separated) [udp://syslogserver]: 
WARNING: 
Disk Max Total Latency
# Disk Max Total Latency Settings in Milliseconds [50]: 
# Disk Max Total Latency range to inspect (1-24) Hours [24]: 
WARNING: 
Lost Access to Volume
# Set the number of days of Lost Action Volume to report and count on [1]: 
WARNING: 
Check LUNS have the recommended number of paths
# Set the Recommended number of paths per LUN [2]: 
WARNING: 
ESXi Inode Exhaustion
# Set the ESXi filesystem free Inode threshold in percent [40]: 
WARNING: 
Host Profile Compliance
# Show detailed information in report [$true]: 
# Show compliant servers [$false]: 
WARNING: 
Hosts with Upcoming Certificate Expiration
# How many days to warn before cert expiration (Default 60) [60]: 
WARNING: 
Host Multipath Policy
# The Multipath Policy (PSP Plugin) your hosts should be configured to use [VMW_PSP_RR]: 
WARNING: 
Host Power Management Policy
# Which power management policy should your hosts use? For Balanced enter "dynamic" (this is the ESXi default policy), for High Performance enter "static", for Low power enter "low". [dynamic]: 
WARNING: 
Datastore Information
# Set the warning threshold for Datastore % Free Space [15]: 
# Do not report on any Datastores that are defined here (Datastore Free Space Plugin) [local]: 
WARNING: 
Number of VMs per Datastore
# Max number of VMs per Datastore [5]: 
# Exclude these datastores from report [ExcludeMe]: 
WARNING: 
Datastore OverAllocation
# Datastore OverAllocation % [50]: 
# Exclude these datastores from report []: 
WARNING: 
Datastores with Storage IO Control Disabled
# Do not report on any Datastores that are defined here (Storage IO Control disabled Plugin) [local]: 
WARNING: 
sDRS VM Behavior not Default
# Exclude these VMs from report []: 
WARNING: 
VSAN Datastore Capacity
# Set the warning threshold for VSAN Datastore % Free Space [15]: 
WARNING: 
VSAN Configuration Maximum Disk Group Per Host Report
# Percentage threshold to warn? [80]: 
WARNING: 
VSAN Configuration Maximum Magnetic Disks Per Disk Group Report
# Percentage threshold to warn? [50]: 
WARNING: 
VSAN Configuration Maximum Total Magnetic Disks In All Disk Groups Per Host Report
# Percentage threshold to warn? [50]: 
WARNING: 
VSAN Configuration Maximum Components Per Host Report
# Percentage threshold to warn? [50]: 
WARNING: 
VSAN Configuration Maximum Hosts Per VSAN Cluster Report
# Percentage threshold to warn? [45]: 
WARNING: 
VSAN Configuration Maximum VMs Per Host Report
# Percentage threshold to warn? [50]: 
WARNING: 
VSAN Configuration Maximum VMs Per VSAN Cluster Report
# Percentage threshold to warn? [50]: 
WARNING: 
Checking Standard vSwitch Ports Free
# vSwitch Port Left [5]: 
WARNING: 
Checking Distributed vSwitch Port Groups for Ports Free
# Distributed vSwitch PortGroup Ports Left [10]: 
WARNING: 
vSwitch Security
# Warn for AllowPromiscuous enabled? [$true]: 
# Warn for ForgedTransmits enabled? [$true]: 
# Warn for MacChanges enabled? [$true]: 
WARNING: 
Snapshot Information
# Set the warning threshold for snapshots in days old [14]: 
# Set snapshot name exception (regex) [ExcludeMe]: 
# Set snapshot description exception (regex) [ExcludeMe]: 
# Set snapshot creator exception (regex) [ExcludeMe]: 
WARNING: 
Map disk region event
    # Set the number of days to show Map disk region event for [5]: 
WARNING: 
Created or cloned VMs
# Set the number of days to show VMs created for [5]: 
WARNING: 
Removed VMs
# Set the number of days to show VMs removed for [5]: 
WARNING: 
VMs with over CPU Count
# Define the maximum amount of vCPUs your VMs are allowed [2]: 
WARNING: 
VMs restarted due to Guest OS Error
# HA VM reset day(s) number due to Guest OS error [5]: 
WARNING: 
Guests with less than X MB free
# VM Disk space left, set the amount you would like to report on MBFree [1024]: 
# VM Disk space left, set the amount you would like to report on MBDiskMinSize [1024]: 
WARNING: 
Checking VM Hardware Version
# Hardware Version to check for at least [8]: 
# Adding filter for dsvas, vShield appliances or any other vms that will remain on a lower HW version [vShield*|dsva*]: 
WARNING: 
VMs in inconsistent folders
# Specify which Datastore(s) to filter from report [local]: 
WARNING: 
No VM Tools
# Do not report on any VMs who are defined here (regex) []: 
WARNING: 
VM Tools Issues
# VM Tools Issues, do not report on any VMs who are defined here []: 
WARNING: 
Removable Media Connected
# VMs with removable media not to report on []: 
WARNING: 
Single Storage VMs
# Local Stored VMs, do not report on any VMs who are defined here [Template_*|VDI*]: 
# Local Datastores, do not report on any VMs within these datastores [Local|datastore1]: 
WARNING: 
VM CPU %RDY
# CPU ready on VMs should not exceed [10.0]: 
WARNING: 
VM CPU Usage
# VM Not to go over the following amount of CPU [75]: 
# VM CPU not allowed to go over the previous amount for how many days? [1]: 
WARNING: 
Backup Garbage
# Names used in backup product snapshots. Defaults include VCB, Veeam, NetBackup, and Commvault [VCB|Consolidate|veeam|NBU_SNAPSHOT|GX_BACKUP]: 
WARNING: 
Find VMs with thick or thin provisioned vmdk
# Report on disk formats that are not "thin" or "thick", which format is not allowed? [thick]: 
# Specify Datastores to filter from report [local]: 
WARNING: 
Virtual machines with incorrect OS configuration
# VMs with incorrect OS Configuration, do not report on any VMs who are defined here [VM1_*|VM2_*]: 
WARNING: 
Virtual machines with less hard disks than partitions
# Do not report on any VMs who are defined here (regex) [VM1_*|VM2_*]: 
WARNING: 
Powered Off VMs
# VMs not to report on [Windows7*]: 
#VmPathName not to report on [-backup-]: 
# Report VMs powered off over this many days [7]: 
WARNING: 
Unwanted virtual hardware found
# Find unwanted virtual hardware [VirtualUSBController|VirtualParallelPort|VirtualSerialPort]: 
WARNING: 
Mis-named virtual machines
# Misnamed VMs, do not report on any VMs who are defined here [VM1_*|VM2_*]: 
WARNING: 
VM Network State
# Only show NICs that are set to Connect at Startup [$true]: 
WARNING: 
Reset VMs
# Set the number of days to show reset VMs [1]: 
WARNING: 
Snapshot activity
# Set the number of days to show Snapshots for [5]: 
# User exception for Snapshot removed [s-veeam]: 
WARNING: 
VMs with CPU or Memory Reservations Configured
# Do not report on any VMs who are defined here []: 
WARNING: 
VM Logging
# The number of logs to keep for each VM [10]: 
# The size logs can reach before rotating to a new log (bytes) [1000000]: 
WARNING: 
VM Tools Not Up to Date
# Do not report on any VMs who are defined here (regex) []: 
# Maximum number of VMs shown [30]: 
WARNING: 
NonPersistent Disks
# Exclude all virtual machines from report [^DV-|^MLB-]: 
WARNING: 
VMs Memory/CPU Hot Add configuration
# Should CPU hot plug be enabled [$true]: 
# Should Memory hot add be enabled [$true]: 
WARNING: 
VM - Display all VMs with CBT unexpected status
# Should CBT be enabled (true/false) [$false]: 
WARNING: 
Site Recovery Manager - RPO Violation Report
# SRM RPO Violations: Set the number of minutes an RPO has exceeded to report on [240]: 
# SRM RPO Violations: Only look for RPO events on VMs with these names: (regex) []: 
# SRM RPO Violations: Report on unresolved RPO violations only? [$true]: 
Specify Credential
Please specify server credential
User: 
User: 
User: 
User: administrator@vsphere.local
Password for user administrator@vsphere.local: ********

After setting up the initial configuration we can start running the main script of the tool using the <vCheck.ps1 -Outputpath> command. The “Outputpath” option allows us to set where the report will be saved. When you run the command it will ask you for the vCenter login credentials. In my case I used the default administrator account but it is recommended to use an account with read-only privileges.

PS /home/blabla/vCheck> ./vCheck.ps1 -Outputpath vcheck-reports/                                   

Specify Credential
Please specify server credential
User: administrator@vsphere.local #vCenter credentials
Password for user administrator@vsphere.local: ********

In this area I show you the example of the vCheck collection process. To see the result of the process, just click on the “+” icon.

vCheck Report Processing

Begin Plugin Processing                                                                                                                                                                                                                                                                             [21:54:30] ..start calculating Connection settings for vCenter by Alan Renouf v1.20 [1 of 116]                                                                                                                                                                                                      [21:54:52] ..finished calculating Connection settings for vCenter by Alan Renouf v1.20 [1 of 116]                                                                                                                                                                                                   [21:54:52] ..start calculating General Information by Alan Renouf, Frederic Martin v1.3 [2 of 116]                                                                                                                                                                                                  [21:55:04] ..finished calculating General Information by Alan Renouf, Frederic Martin v1.3 [2 of 116]                                                                                                                                                                                               [21:55:04] ..start calculating Checking VI Events by Alan Renouf v1.2 [3 of 116]                                                                                                                                                                                                                    [21:55:05] ..finished calculating Checking VI Events by Alan Renouf v1.2 [3 of 116]                                                                                                                                                                                                                 [21:55:05] ..start calculating VC Services by Alan Renouf v1.1 [4 of 116]                                                                                                                                                                                                                           [21:55:05] ..finished calculating VC Services by Alan Renouf v1.1 [4 of 116]                                                                                                                                                                                                                        [21:55:05] ..start calculating Windows vCenter Error Event Logs by Alan Renouf v1.2 [5 of 116]                                                                                                                                                                                                      [21:55:05] ..finished calculating Windows vCenter Error Event Logs by Alan Renouf v1.2 [5 of 116]                                                                                                                                                                                                   [21:55:05] ..start calculating Windows vCenter Error Event Logs by Alan Renouf v1.2 [6 of 116]                                                                                                                                                                                                      [21:55:05] ..finished calculating Windows vCenter Error Event Logs by Alan Renouf v1.2 [6 of 116]                                                                                                                                                                                                   [21:55:05] ..start calculating Windows vCenter Warning Event Logs by Alan Renouf v1.2 [7 of 116]                                                                                                                                                                                                    [21:55:05] ..finished calculating Windows vCenter Warning Event Logs by Alan Renouf v1.2 [7 of 116]                                                                                                                                                                                                 [21:55:05] ..start calculating vCenter Sessions Age by Rudolf Kleijwegt v1.2 [8 of 116]                                                                                                                                                                                                             [21:55:05] ..finished calculating vCenter Sessions Age by Rudolf Kleijwegt v1.2 [8 of 116]                                                                                                                                                                                                          [21:55:05] ..start calculating vCenter License Report by Justin Mercier, Bill Wall v1.2 [9 of 116]                                                                                                                                                                                                  [21:55:05] ..finished calculating vCenter License Report by Justin Mercier, Bill Wall v1.2 [9 of 116]                                                                                                                                                                                               [21:55:05] ..start calculating HA configuration issues by John Sneddon v1.1 [10 of 116]                                                                                                                                                                                                             [21:55:06] ..finished calculating HA configuration issues by John Sneddon v1.1 [10 of 116]                                                                                                                                                                                                          [21:55:06] ..start calculating HA VMs restarted by Alan Renouf v1.3 [11 of 116]                                                                                                                                                                                                                     [21:55:06] ..finished calculating HA VMs restarted by Alan Renouf v1.3 [11 of 116]                                                                                                                                                                                                                  [21:55:06] ..start calculating DRS & SDRS Migrations by Alan Renouf, Jonathan Medd v1.3 [12 of 116]                                                                                                                                                                                                 [21:55:06] ..finished calculating DRS & SDRS Migrations by Alan Renouf, Jonathan Medd v1.3 [12 of 116]                                                                                                                                                                                              [21:55:06] ..start calculating Cluster Slot Sizes by Alan Renouf v1.2 [13 of 116]                                                                                                                                                                                                                   [21:55:06] ..finished calculating Cluster Slot Sizes by Alan Renouf v1.2 [13 of 116]                                                                                                                                                                                                                [21:55:06] ..start calculating Cluster Configuration Issues by Alan Renouf v1.1 [14 of 116]                                                                                                                                                                                                         [21:55:06] ..finished calculating Cluster Configuration Issues by Alan Renouf v1.1 [14 of 116]                                                                                                                                                                                                      [21:55:06] ..start calculating Datastore Consistency by Robert Sexstone v1.6 [15 of 116]                                                                                                                                                                                                            [21:55:07] ..finished calculating Datastore Consistency by Robert Sexstone v1.6 [15 of 116]                                                                                                                                                                                                         [21:55:07] ..start calculating Clusters with DRS disabled by Robert van den Nieuwendijk v1.3 [16 of 116]                                                                                                                                                                                            [21:55:07] ..finished calculating Clusters with DRS disabled by Robert van den Nieuwendijk v1.3 [16 of 116]                                                                                                                                                                                         [21:55:07] ..start calculating Cluster Node version by Raphael Schitz, Frederic Martin v1.1 [17 of 116]                                                                                                                                                                                             [21:55:07] ..finished calculating Cluster Node version by Raphael Schitz, Frederic Martin v1.1 [17 of 116]                                                                                                                                                                                          [21:55:07] ..start calculating QuickStats Capacity Planning by Raphael Schitz, Frederic Martin v1.7 [18 of 116]                                                                                                                                                                                     [21:55:07] ..finished calculating QuickStats Capacity Planning by Raphael Schitz, Frederic Martin v1.7 [18 of 116]                                                                                                                                                                                  [21:55:07] ..start calculating s/vMotion Information by Alan Renouf v1.2 [19 of 116]                                                                                                                                                                                                                [21:55:08] ..finished calculating s/vMotion Information by Alan Renouf v1.2 [19 of 116]                                                                                                                                                                                                             [21:55:08] ..start calculating More RAM than free space on Datastore by Olivier TABUT, Bob Cote v1.2 [20 of 116]                                                                                                                                                                                    [21:55:08] ..finished calculating More RAM than free space on Datastore by Olivier TABUT, Bob Cote v1.2 [20 of 116]                                                                                                                                                                                 [21:55:08] ..start calculating DRS Rules by John Sneddon v1.2 [21 of 116]                                                                                                                                                                                                                           WARNING: Retrieving VM group to VMHost group DRS rules with Get-DrsRule is obsolete. Use Get-DrsVMHostRule cmdlet instead                                                                                                                                                                           [21:55:08] ..finished calculating DRS Rules by John Sneddon v1.2 [21 of 116]                                                                                                                                                                                                                        [21:55:08] ..start calculating Clusters Without Host Profile attached by John Sneddon v1.0 [22 of 116]                                                                                                                                                                                              [21:55:08] ..finished calculating Clusters Without Host Profile attached by John Sneddon v1.0 [22 of 116]                                                                                                                                                                                           [21:55:08] ..start calculating Hosts Overcommit state by Alan Renouf v1.4 [23 of 116]                                                                                                                                                                                                               [21:55:09] ..finished calculating Hosts Overcommit state by Alan Renouf v1.4 [23 of 116]                                                                                                                                                                                                            [21:55:09] ..start calculating Hosts Dead LUN Path by Alan Renouf, Frederic Martin v1.2 [24 of 116]                                                                                                                                                                                                 [21:55:09] ..finished calculating Hosts Dead LUN Path by Alan Renouf, Frederic Martin v1.2 [24 of 116]                                                                                                                                                                                              [21:55:09] ..start calculating Host Swapfile datastores by Alan Renouf v1.2 [25 of 116]                                                                                                                                                                                                             [21:55:09] ..finished calculating Host Swapfile datastores by Alan Renouf v1.2 [25 of 116]                                                                                                                                                                                                          [21:55:09] ..start calculating ESXi with Technical Support mode or ESXi Shell enabled by Alan Renouf v1.3 [26 of 116]                                                                                                                                                                               [21:55:09] ..finished calculating ESXi with Technical Support mode or ESXi Shell enabled by Alan Renouf v1.3 [26 of 116]                                                                                                                                                                            [21:55:09] ..start calculating ESXi hosts which do not have Lockdown mode enabled by Alan Renouf v1.1 [27 of 116]                                                                                                                                                                                   [21:55:09] ..finished calculating ESXi hosts which do not have Lockdown mode enabled by Alan Renouf v1.1 [27 of 116]                                                                                                                                                                                [21:55:09] ..start calculating Active Directory Authentication by Bill Wall, Dan Barr v1.2 [28 of 116]                                                                                                                                                                                              [21:55:10] ..finished calculating Active Directory Authentication by Bill Wall, Dan Barr v1.2 [28 of 116]                                                                                                                                                                                           [21:55:10] ..start calculating NTP Name and Service by Alan Renouf, Dan Barr v1.3 [29 of 116]                                                                                                                                                                                                       [21:55:10] ..finished calculating NTP Name and Service by Alan Renouf, Dan Barr v1.3 [29 of 116]                                                                                                                                                                                                    [21:55:10] ..start calculating Host Configuration Issues by Alan Renouf, Dan Barr v1.2 [30 of 116]                                                                                                                                                                                                  [21:55:10] ..finished calculating Host Configuration Issues by Alan Renouf, Dan Barr v1.2 [30 of 116]                                                                                                                                                                                               [21:55:10] ..start calculating Host Alarms by Alan Renouf, John Sneddon v1.3 [31 of 116]
[22:33:17] ..Displaying HTML results

Once the command finishes, an< .html> file will be created with the result of the report. vCheck has the feature of being able to schedule the report to be sent by e-mail on a recurring basis.. So, you can have a weekly report of how is the health of your virtual infrastructure.

Here are several examples of report generated with vCheck

I hope you liked this tool. If you have any questions or comments about this post, leave them in comments. Regards.