Skip to content

Commit

Permalink
vDocumentation v2.4.7
Browse files Browse the repository at this point in the history
vDocumentation v2.4.7
  • Loading branch information
edmsanchez committed Nov 30, 2018
1 parent 06ceb29 commit 1a0d9b5
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 91 deletions.
47 changes: 21 additions & 26 deletions powershell/vDocumentation/Public/Get-ESXIODevice.ps1
Expand Up @@ -13,7 +13,7 @@
Author : Edgar Sanchez - @edmsanchez13
Contributor : Ariel Sanchez - @arielsanchezmor
Contributor : @pdpelsem
Version : 2.4.5.2
Version : 2.4.7
.Link
https://github.com/arielsanchezmora/vDocumentation
.INPUTS
Expand Down Expand Up @@ -56,13 +56,13 @@
<#
----------------------------------------------------------[Declarations]----------------------------------------------------------
#>
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'VMhost')]
param (
[Parameter(Mandatory = $false,
ParameterSetName = "VMhost")]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[String[]]$VMhost,
[String[]]$VMhost = "*",
[Parameter(Mandatory = $false,
ParameterSetName = "Cluster")]
[ValidateNotNull()]
Expand Down Expand Up @@ -93,6 +93,9 @@
#>

$stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($PSBoundParameters.ContainsKey('Cluster') -or $PSBoundParameters.ContainsKey('DataCenter')) {
[String[]]$VMhost = $null
} #END if

<#
Query PowerCLI and vDocumentation versions if
Expand Down Expand Up @@ -136,7 +139,7 @@
} #END if
if ($Cluster) {
Write-Verbose -Message ((Get-Date -Format G) + "`tExecuting Cmdlet using Cluster parameter set")
Write-Output "`tGathering host list from the following Cluster(s): " (@($Cluster) -join ',')
Write-Output ("`tGathering host list from the following Cluster(s): " + (@($Cluster) -join ','))
foreach ($vClusterName in $Cluster) {
$tempList = Get-Cluster -Name $vClusterName.Trim() -ErrorAction SilentlyContinue | Get-VMHost
if ($tempList) {
Expand All @@ -149,7 +152,7 @@
} #END if
if ($DataCenter) {
Write-Verbose -Message ((Get-Date -Format G) + "`tExecuting Cmdlet using Datacenter parameter set")
Write-Output "`tGathering host list from the following DataCenter(s): " (@($DataCenter) -join ',')
Write-Output ("`tGathering host list from the following DataCenter(s): " + (@($DataCenter) -join ','))
foreach ($vDCname in $DataCenter) {
$tempList = Get-Datacenter -Name $vDCname.Trim() -ErrorAction SilentlyContinue | Get-VMHost
if ($tempList) {
Expand Down Expand Up @@ -212,7 +215,7 @@
Write-Verbose -Message ((Get-Date -Format G) + "`tValidating access to VMware HCL site...")
$hclDataUrl = "https://www.vmware.com/resources/compatibility/js/data_io.js?"
try {
$webRequest = Invoke-WebRequest -Uri $hclDataUrl
$webRequest = Invoke-WebRequest -Uri $hclDataUrl -UseBasicParsing
}
catch [System.Net.WebException] {
$webRequest = $_.Exception.Response
Expand Down Expand Up @@ -252,20 +255,15 @@
$hclDataUrl = "https://www.vmware.com/resources/compatibility/search.php?deviceCategory=io"
$brandJson = $null
try {
$webRequest = Invoke-WebRequest -Uri $hclDataUrl
$webRequest = Invoke-WebRequest -Uri $hclDataUrl -UseBasicParsing
}
catch [System.Net.WebException] {
$webRequest = $_.Exception.Response
} #END try/catch
if ([int]$webRequest.StatusCode -eq "200") {
$webElement = $webRequest.AllElements | Where-Object { $_.tagName -eq "script"}
foreach ($element in $webElement) {
if ($null -ne $element.innerHTML -and $element.innerHTML.trim().StartsWith("var releases")) {
$webElementHtml = $element.innerHTML.trim()
} #END if
} #END foreach
$brandElement = $webElementHtml.Remove(0, $webElementHtml.IndexOf('var partners'))
$brandSubstring = $brandElement.Substring($brandElement.IndexOf("=") + 1, $brandElement.IndexOf("};") + 1 - $brandElement.IndexOf("=") - 1).trim()
$webContent = $webRequest.Content
$webContent = $webContent.Remove(0, $webContent.IndexOf('var partners = {'))
$brandSubstring = $webContent.Substring($webContent.IndexOf("=") + 1, $webContent.IndexOf("};") + 1 - $webContent.IndexOf("=") - 1).trim()
$brandJson = $brandSubstring | ConvertFrom-Json -ErrorAction SilentlyContinue
}
else {
Expand Down Expand Up @@ -307,10 +305,10 @@
Write-Host "`tGathering information from $esxiHost ..."
$esxiUpdateLevel = (Get-AdvancedSetting -Name "Misc.HostAgentUpdateLevel" -Entity $esxiHost -ErrorAction SilentlyContinue -ErrorVariable err).Value
if ($esxiUpdateLevel) {
$esxiVersion = "ESXi " + ($esxiHost.ApiVersion) + " U" + $esxiUpdateLevel
$esxiVersion = "ESXi " + ($esxiHost.Version).Substring(0, 3) + " U" + $esxiUpdateLevel
}
else {
$esxiVersion = "ESXi " + ($esxiHost.ApiVersion)
$esxiVersion = "ESXi " + ($esxiHost.Version).Substring(0, 3)
Write-Verbose -Message ((Get-Date -Format G) + "`tFailed to get ESXi Update Level, Error : " + $err)
} #END if/else
$pciDevices = $esxcli.hardware.pci.list.Invoke() | Where-Object {$_.VMKernelName -like "vmhba*" -or $_.VMKernelName -like "vmnic*" -or $_.VMKernelName -like "vmgfx*"} | Sort-Object -Property VMKernelName
Expand Down Expand Up @@ -414,7 +412,7 @@
#>
if ($hclIoCollection -and $brandJson) {
Write-Verbose -Message ((Get-Date -Format G) + "`tGathering IO device HCL details...")
$ioDevices = $ioDeviceCollection | Sort-Object -Property ProductId,Version -Unique
$ioDevices = $ioDeviceCollection | Sort-Object -Property ProductId, Version -Unique
foreach ($ioDevice in $ioDevices) {
if ($ioDevice.ProductId) {
$productIds = $ioDevice.ProductId.Split(',')
Expand All @@ -425,19 +423,16 @@
$ssid = $ioDevice.SSID
$hclDataUrl = "https://www.vmware.com/resources/compatibility/detail.php?deviceCategory=io&productid=$productId&deviceCategory=io&details=1&VID=$vid&DID=$did&SVID=$svid&SSID=$ssid&page=1&display_interval=10&sortColumn=Partner&sortOrder=Asc"
try {
$webRequest = Invoke-WebRequest -Uri $hclDataUrl
$webRequest = Invoke-WebRequest -Uri $hclDataUrl -UseBasicParsing
}
catch [System.Net.WebException] {
$webRequest = $_.Exception.Response
} #END try/catch
if ([int]$webRequest.StatusCode -eq "200") {
$webElement = $webRequest.AllElements | Where-Object { $_.tagName -eq "script"}
foreach ($element in $webElement) {
if ($null -ne $element.innerHTML -and $element.innerHTML.trim().StartsWith("var details")) {
$webElementHtml = $element.innerHTML.trim()
} #END if
} #END foreach
$detailSubstring = $webElementHtml.Substring($webElementHtml.IndexOf("=[") + 1, $webElementHtml.IndexOf("];") + 1 - $webElementHtml.IndexOf("=[") - 1).trim()
$webContent = $webRequest.Content
$webElementHtml = $webContent.Remove(0, $webContent.IndexOf('<body>'))
$webvarDetails = $webElementHtml.Remove(0, $webElementHtml.IndexOf('var details'))
$detailSubstring = $webvarDetails.Substring($webvarDetails.IndexOf("=[") + 1, $webvarDetails.IndexOf("];") + 1 - $webvarDetails.IndexOf("=[") - 1).trim()
$detailJson = $detailSubstring | ConvertFrom-Json -ErrorAction SilentlyContinue
$deviceList = $detailJson | Where-Object {$_.ReleaseVersion -eq $ioDevice.Version}

Expand Down
30 changes: 18 additions & 12 deletions powershell/vDocumentation/Public/Get-ESXInventory.ps1
Expand Up @@ -11,7 +11,7 @@
File Name : Get-ESXInventory.ps1
Author : Edgar Sanchez - @edmsanchez13
Contributor : Ariel Sanchez - @arielsanchezmor
Version : 2.4.5
Version : 2.4.7
.Link
https://github.com/arielsanchezmora/vDocumentation
.INPUTS
Expand Down Expand Up @@ -68,14 +68,14 @@
in PSScriptAnalyzer code analysis. It's a one time token
that is converted to secure string, not clear text string
#>
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'VMhost')]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("AvoidUsingConvertToSecureStringWithPlainText", "")]
param (
[Parameter(Mandatory = $false,
ParameterSetName = "VMhost")]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[String[]]$VMhost,
[String[]]$VMhost = "*",
[Parameter(Mandatory = $false,
ParameterSetName = "Cluster")]
[ValidateNotNull()]
Expand Down Expand Up @@ -108,6 +108,9 @@
#>

$stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($PSBoundParameters.ContainsKey('Cluster') -or $PSBoundParameters.ContainsKey('DataCenter')) {
[String[]]$VMhost = $null
} #END if

<#
Query PowerCLI and vDocumentation versions if
Expand Down Expand Up @@ -151,7 +154,7 @@
} #END if
if ($Cluster) {
Write-Verbose -Message ((Get-Date -Format G) + "`tExecuting Cmdlet using Cluster parameter set")
Write-Output "`tGathering host list from the following Cluster(s): " (@($Cluster) -join ',')
Write-Output ("`tGathering host list from the following Cluster(s): " + (@($Cluster) -join ','))
foreach ($vClusterName in $Cluster) {
$tempList = Get-Cluster -Name $vClusterName.Trim() -ErrorAction SilentlyContinue | Get-VMHost
if ($tempList) {
Expand All @@ -164,7 +167,7 @@
} #END if
if ($DataCenter) {
Write-Verbose -Message ((Get-Date -Format G) + "`tExecuting Cmdlet using Datacenter parameter set")
Write-Output "`tGathering host list from the following DataCenter(s): " (@($DataCenter) -join ',')
Write-Output ("`tGathering host list from the following DataCenter(s): " + (@($DataCenter) -join ','))
foreach ($vDCname in $DataCenter) {
$tempList = Get-Datacenter -Name $vDCname.Trim() -ErrorAction SilentlyContinue | Get-VMHost
if ($tempList) {
Expand Down Expand Up @@ -276,7 +279,14 @@
$esxcli = Get-EsxCli -VMHost $esxiHost -V2
$hostHardware = $esxiHost | Get-VMHostHardware -WaitForAllData -SkipAllSslCertificateChecks -ErrorAction SilentlyContinue
$vmhostView = $esxiHost | Get-View
$esxiVersion = $esxcli.system.version.get.Invoke()
$esxiUpdateLevel = (Get-AdvancedSetting -Name "Misc.HostAgentUpdateLevel" -Entity $esxiHost -ErrorAction SilentlyContinue -ErrorVariable err).Value
if ($esxiUpdateLevel) {
$esxiVersion = ($esxiHost.Version) + " U" + $esxiUpdateLevel
}
else {
$esxiVersion = $esxiHost.Version
Write-Verbose -Message ((Get-Date -Format G) + "`tFailed to get ESXi Update Level, Error : " + $err)
} #END if/else

<#
Get Hardware invetory details
Expand Down Expand Up @@ -342,10 +352,8 @@
'RAC MAC' = $racMAC
'RAC Firmware' = $bmcFirmware
'Product' = $vmhostView.Config.Product.Name
'Version' = $vmhostView.Config.Product.Version
'Version' = $esxiVersion
'Build' = $esxiHost.Build
'Update' = $esxiVersion.Update
'Patch' = $esxiVersion.Patch
'Make' = $hostHardware.Manufacturer
'Model' = $hostHardware.Model
'S/N' = $hardwarePlatfrom.serialNumber
Expand Down Expand Up @@ -471,10 +479,8 @@
'Hyper-Threading' = $esxiHost.HyperthreadingActive
'Max EVC Mode' = $esxiHost.MaxEVCMode
'Product' = $vmhostView.Config.Product.Name
'Version' = $vmhostView.Config.Product.Version
'Version' = $esxiVersion
'Build' = $esxiHost.Build
'Update' = $esxiVersion.Update
'Patch' = $esxiVersion.Patch
'Install Type' = $installType
'Boot From' = $bootSource
'Device Model' = $bootVendor
Expand Down
14 changes: 8 additions & 6 deletions powershell/vDocumentation/Public/Get-ESXNetworking.ps1
Expand Up @@ -9,7 +9,7 @@
File Name : Get-ESXNetworking.ps1
Author : Edgar Sanchez - @edmsanchez13
Contributor : Ariel Sanchez - @arielsanchezmor
Version : 2.4.5
Version : 2.4.7
.Link
https://github.com/arielsanchezmora/vDocumentation
.INPUTS
Expand Down Expand Up @@ -65,13 +65,13 @@
<#
----------------------------------------------------------[Declarations]----------------------------------------------------------
#>
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'VMhost')]
param (
[Parameter(Mandatory = $false,
ParameterSetName = "VMhost")]
[ValidateNotNull()]
[ValidateNotNullOrEmpty()]
[String[]]$VMhost,
[String[]]$VMhost = "*",
[Parameter(Mandatory = $false,
ParameterSetName = "Cluster")]
[ValidateNotNull()]
Expand Down Expand Up @@ -105,6 +105,9 @@
#>

$stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($PSBoundParameters.ContainsKey('Cluster') -or $PSBoundParameters.ContainsKey('DataCenter')) {
[String[]]$VMhost = $null
} #END if

<#
Query PowerCLI and vDocumentation versions if
Expand All @@ -128,7 +131,6 @@
Write-Error -Message "You must be connected to a vSphere server before running this Cmdlet."
break
} #END if/else


<#
Gather host list based on Parameter set used
Expand All @@ -149,7 +151,7 @@
} #END if
if ($Cluster) {
Write-Verbose -Message ((Get-Date -Format G) + "`tExecuting Cmdlet using Cluster parameter set")
Write-Output "`tGathering host list from the following Cluster(s): " (@($Cluster) -join ',')
Write-Output ("`tGathering host list from the following Cluster(s): " + (@($Cluster) -join ','))
foreach ($vClusterName in $Cluster) {
$tempList = Get-Cluster -Name $vClusterName.Trim() -ErrorAction SilentlyContinue | Get-VMHost
if ($tempList) {
Expand All @@ -162,7 +164,7 @@
} #END if
if ($DataCenter) {
Write-Verbose -Message ((Get-Date -Format G) + "`tExecuting Cmdlet using Datacenter parameter set")
Write-Output "`tGathering host list from the following DataCenter(s): " (@($DataCenter) -join ',')
Write-Output ("`tGathering host list from the following DataCenter(s): " + (@($DataCenter) -join ','))
foreach ($vDCname in $DataCenter) {
$tempList = Get-Datacenter -Name $vDCname.Trim() -ErrorAction SilentlyContinue | Get-VMHost
if ($tempList) {
Expand Down

0 comments on commit 1a0d9b5

Please sign in to comment.