diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a9a3de9..c2131ffd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@
Enhancement:
- Added a prerequisite check to `Invoke-VcfHealthReport` function to verify that the tar utility is present on Windows if using Windows PowerShell 5.1 (Desktop) or PowerShell 7 (Core). The `tar` utility is included with Windows Server 2019 and later and is noted as a system requirement in the documentation. [GH-191](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/191)
+- Added support for use of secure strings for sensitive parameters. [GH-199](https://github.com/vmware/powershell-module-for-vmware-cloud-foundation-reporting/pull/199)
## v2.4.2
diff --git a/VMware.CloudFoundation.Reporting.psd1 b/VMware.CloudFoundation.Reporting.psd1
index 8e0ef74c..d93f4ed9 100644
--- a/VMware.CloudFoundation.Reporting.psd1
+++ b/VMware.CloudFoundation.Reporting.psd1
@@ -11,7 +11,7 @@
RootModule = '.\VMware.CloudFoundation.Reporting.psm1'
# Version number of this module.
- ModuleVersion = '2.6.0.1000'
+ ModuleVersion = '2.5.0.1001'
# Supported PSEditions
# CompatiblePSEditions = @()
diff --git a/VMware.CloudFoundation.Reporting.psm1 b/VMware.CloudFoundation.Reporting.psm1
index 46552960..b29ebb9a 100644
--- a/VMware.CloudFoundation.Reporting.psm1
+++ b/VMware.CloudFoundation.Reporting.psm1
@@ -38,6 +38,24 @@ if ($PSEdition -eq 'Desktop') {
}
}
+##########################################################################
+#Region Non Exported Functions ######
+Function Get-Password {
+ param (
+ [string]$user,
+ [string]$password
+ )
+
+ if ([string]::IsNullOrEmpty($password)) {
+ $secureString = Read-Host -Prompt "Enter the password for $user" -AsSecureString
+ $password = ConvertFrom-SecureString $secureString -AsPlainText
+ }
+ return $password
+}
+
+#EndRegion Non Exported Functions ######
+##########################################################################
+
#######################################################################################################################
##################################### J S O N O U T P U T V A R I A B L E S #####################################
@@ -236,9 +254,9 @@ Function Invoke-VcfHealthReport {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerLocalUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerLocalPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$sddcManagerLocalPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$reportPath,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
@@ -246,6 +264,10 @@ Function Invoke-VcfHealthReport {
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$darkMode
)
+ $sddcManagerPass = Get-Password -user $sddcManagerUser -password $sddcManagerPass
+ $sddcManagerLocalPass = Get-Password -user $sddcManagerLocalUser -password $sddcManagerLocalPass
+
+
Try {
Clear-Host; Write-Host ""
@@ -459,7 +481,7 @@ Function Invoke-VcfAlertReport {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$reportPath,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
@@ -467,6 +489,8 @@ Function Invoke-VcfAlertReport {
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$darkMode
)
+ $sddcManagerPass = Get-Password -user $sddcManagerUser -password $sddcManagerPass
+
Try {
Clear-Host; Write-Host ""
@@ -582,13 +606,15 @@ Function Invoke-VcfConfigReport {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$reportPath,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$darkMode
)
+ $sddcManagerPass = Get-Password -user $sddcManagerUser -password $sddcManagerPass
+
Try {
Clear-Host; Write-Host ""
@@ -698,12 +724,14 @@ Function Invoke-VcfUpgradePrecheck {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$reportPath,
[Parameter (ParameterSetName = 'Specific--WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$darkMode
)
+ $sddcManagerPass = Get-Password -user $sddcManagerUser -password $sddcManagerPass
+
Try {
Clear-Host; Write-Host ""
@@ -732,33 +760,24 @@ Function Invoke-VcfUpgradePrecheck {
$elementObject | Add-Member -NotePropertyName 'Component' -NotePropertyValue $subTask.resources.type
if ($subTask.resources.type -eq "ESX") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFHost -id $subTask.resources.resourceId).fqdn
- }
- elseif ($subTask.resources.type -eq "VCENTER") {
+ } elseif ($subTask.resources.type -eq "VCENTER") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFvCenter -id $subTask.resources.resourceId).fqdn
- }
- elseif ($subTask.resources.type -eq "CLUSTER") {
+ } elseif ($subTask.resources.type -eq "CLUSTER") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFCluster -id $subTask.resources.resourceId).name
- }
- elseif ($subTask.resources.type -eq "VSAN") {
+ } elseif ($subTask.resources.type -eq "VSAN") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFCluster -id $subTask.resources.resourceId).primaryDatastoreName
- }
- elseif ($subTask.resources.type -eq "DEPLOYMENT_CONFIGURATION") {
+ } elseif ($subTask.resources.type -eq "DEPLOYMENT_CONFIGURATION") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFManager -id $subTask.resources.resourceId).fqdn
- }
- elseif ($subTask.resources.type -eq "VRSLCM") {
+ } elseif ($subTask.resources.type -eq "VRSLCM") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFvRSLCM -id $subTask.resources.resourceId).fqdn
- }
- elseif ($subTask.resources.type -eq "VROPS") {
+ } elseif ($subTask.resources.type -eq "VROPS") {
$id = $subTask.resources.resourceId + ":vrops"
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFvROPS | Where-Object {$_.id -eq $id}).loadBalancerFqdn
- }
- elseif ($subTask.resources.type -eq "VRLI") {
+ } elseif ($subTask.resources.type -eq "VRLI") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFvRLI -id $subTask.resources.resourceId).loadBalancerFqdn
- }
- elseif ($subTask.resources.type -eq "VRA") {
+ } elseif ($subTask.resources.type -eq "VRA") {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue (Get-VCFvRA -id $subTask.resources.resourceId).loadBalancerFqdn
- }
- else {
+ } else {
$elementObject | Add-Member -NotePropertyName 'Resource' -NotePropertyValue $subTask.resources.resourceId
}
$elementObject | Add-Member -NotePropertyName 'Precheck Task' -NotePropertyValue $subTask.name
@@ -803,8 +822,7 @@ Function Invoke-VcfUpgradePrecheck {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -848,12 +866,14 @@ Function Invoke-VcfOverviewReport {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$reportPath,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$darkMode,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized
)
+ $sddcManagerPass = Get-Password -user $sddcManagerUser -password $sddcManagerPass
+
Try {
Clear-Host; Write-Host ""
@@ -900,8 +920,7 @@ Function Invoke-VcfOverviewReport {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -953,12 +972,14 @@ Function Request-SoSHealthJson {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$reportPath,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -user $user -password $pass
+
# Request VCF Token
Request-VCFToken -fqdn $server -Username $user -Password $pass -skipCertificateCheck -ErrorAction SilentlyContinue -ErrorVariable ErrMsg | Out-Null
$vcfVersion = ((Get-VCFManager).version).Split('-')[0]
@@ -1200,8 +1221,7 @@ Function Publish-CertificateHealth {
} else {
$outputObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -1305,8 +1325,7 @@ Function Publish-ConnectivityHealth {
else {
$customObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -1399,8 +1418,7 @@ Function Publish-PingConnectivityHealth {
} else {
$customObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -1507,8 +1525,7 @@ Function Publish-DnsHealth {
$allForwardLookupObject | Sort-Object Component, Resource
$allReverseLookupObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -1665,8 +1682,7 @@ Function Publish-EsxiHealth {
$allLicenseObject | Sort-Object Component, Resource
$allDiskObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -1816,8 +1832,7 @@ Function Publish-NsxtHealth {
} else {
$customObject | Sort-Object Resource, Component
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -1911,8 +1926,7 @@ Function Publish-NsxtEdgeNodeHealth {
} else {
$customObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2014,8 +2028,7 @@ Function Publish-NsxtEdgeClusterHealth {
} else {
$customObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2097,8 +2110,7 @@ Function Publish-NtpHealth {
} else {
$outputObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2190,8 +2202,7 @@ Function Publish-PasswordHealth {
} else {
$outputObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2280,8 +2291,7 @@ Function Publish-VersionHealth {
} else {
$outputObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2379,8 +2389,7 @@ Function Publish-HardwareCompatibilityHealth {
} else {
$outputObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2470,8 +2479,7 @@ Function Publish-ServiceHealth {
} else {
$outputObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2587,8 +2595,7 @@ Function Publish-VcenterHealth {
} else {
$ringTopologyHealth | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2763,8 +2770,7 @@ Function Publish-VsanHealth {
} else {
$customObject | Sort-Object Component, Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2866,8 +2872,7 @@ Function Publish-VsanStoragePolicy {
} else {
$outputObject | Sort-Object Component, 'vCenter Server', Resource
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -2935,13 +2940,15 @@ Function Publish-BackupStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$outputJson
)
+ $pass = Get-Password -user $user -password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -2995,8 +3002,7 @@ Function Publish-BackupStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3055,7 +3061,7 @@ Function Publish-NsxtTransportNodeStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
@@ -3063,6 +3069,8 @@ Function Publish-NsxtTransportNodeStatus {
)
+ $pass = Get-Password -user $user -password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -3105,8 +3113,7 @@ Function Publish-NsxtTransportNodeStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3165,7 +3172,7 @@ Function Publish-NsxtTransportNodeTunnelStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
@@ -3173,6 +3180,8 @@ Function Publish-NsxtTransportNodeTunnelStatus {
)
+ $pass = Get-Password -user $user -password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -3215,8 +3224,7 @@ Function Publish-NsxtTransportNodeTunnelStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3275,13 +3283,15 @@ Function Publish-NsxtTier0BgpStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$outputJson
)
+ $pass = Get-Password -user $user -password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -3325,8 +3335,7 @@ Function Publish-NsxtTier0BgpStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3391,13 +3400,15 @@ Function Publish-SnapshotStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$outputJson
)
+ $pass = Get-Password -user $user -password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -3451,8 +3462,7 @@ Function Publish-SnapshotStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3513,13 +3523,15 @@ Function Publish-NsxtHealthNonSOS {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$outputJson
)
+ $pass = Get-Password -user $user -password $pass
+
Try {
$allNsxtHealthObject = New-Object System.Collections.ArrayList
$allWorkloadDomains = Get-VCFWorkloadDomain
@@ -3558,8 +3570,7 @@ Function Publish-NsxtHealthNonSOS {
$allNsxtHealthObject
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3612,13 +3623,15 @@ Function Publish-NsxtCombinedHealth {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$json,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -user $user -password $pass
+
Try {
$allNsxtHealthObject = New-Object System.Collections.ArrayList
$allWorkloadDomains = Get-VCFWorkloadDomain
@@ -3654,8 +3667,7 @@ Function Publish-NsxtCombinedHealth {
}
$allNsxtHealthObject = Convert-CssClass -htmldata $allNsxtHealthObject
$allNsxtHealthObject
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3721,15 +3733,18 @@ Function Publish-StorageCapacityHealth {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$localUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$localPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$localPass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$outputJson
)
+ $pass = Get-Password -user $user -password $pass
+ $localPass = Get-Password -user $localUser -password $localPass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -3826,8 +3841,7 @@ Function Publish-StorageCapacityHealth {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3873,11 +3887,13 @@ Function Request-NsxtVidmStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -3930,8 +3946,7 @@ Function Request-NsxtVidmStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -3977,11 +3992,13 @@ Function Request-NsxtComputeManagerStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -4033,8 +4050,7 @@ Function Request-NsxtComputeManagerStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -4077,10 +4093,12 @@ Function Request-SddcManagerSnapshotStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -4154,8 +4172,7 @@ Function Request-SddcManagerSnapshotStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -4201,11 +4218,13 @@ Function Request-VcenterSnapshotStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -4281,8 +4300,7 @@ Function Request-VcenterSnapshotStatus {
$outputObject | Sort-Object Component, Resource, Element
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -4328,11 +4346,13 @@ Function Request-NsxtEdgeSnapshotStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -4414,8 +4434,7 @@ Function Request-NsxtEdgeSnapshotStatus {
}
}
$outputObject | Sort-Object Component, Resource, Element
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -4456,10 +4475,12 @@ Function Request-SddcManagerBackupStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -4536,8 +4557,7 @@ Function Request-SddcManagerBackupStatus {
$customObject | Sort-Object Component, Resource, Element
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -4583,11 +4603,13 @@ Function Request-NsxtManagerBackupStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -4778,8 +4800,7 @@ Function Request-NsxtManagerBackupStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -4825,12 +4846,14 @@ Function Request-VcenterBackupStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -4920,8 +4943,7 @@ Function Request-VcenterBackupStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -4967,11 +4989,13 @@ Function Request-DatastoreStorageCapacity {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
# Define thresholds Green < Yellow < Red
$greenThreshold = 80
$redThreshold = 90
@@ -5025,8 +5049,7 @@ Function Request-DatastoreStorageCapacity {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
@@ -5073,11 +5096,13 @@ Function Request-VcenterStorageHealth {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -5102,8 +5127,7 @@ Function Request-VcenterStorageHealth {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5149,12 +5173,15 @@ Function Request-SddcManagerStorageHealth {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$localUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$localPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$localPass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+ $localPass = Get-Password -User $localUser -Password $localPass
+
Try {
# Define the command for retrieving the disk information.
# Ignore the loopback device from the output.
@@ -5166,8 +5193,7 @@ Function Request-SddcManagerStorageHealth {
} else {
Format-DfStorageHealth -dfOutput $dfOutput -systemFqdn $server
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5212,11 +5238,13 @@ Function Request-EsxiStorageCapacity {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -5256,8 +5284,7 @@ Function Request-EsxiStorageCapacity {
$esxiPartitionsObject | Sort-Object Domain, 'ESXi FQDN', 'Volume Name', Alert
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5318,13 +5345,15 @@ Function Publish-ComponentConnectivityHealthNonSOS {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$outputJson
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
$allConnectivityObject = New-Object System.Collections.ArrayList
if ($PsBoundParameters.ContainsKey('failureOnly')) {
@@ -5359,8 +5388,7 @@ Function Publish-ComponentConnectivityHealthNonSOS {
$allConnectivityObject = Convert-CssClass -htmldata $allConnectivityObject
$allConnectivityObject
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5415,13 +5443,15 @@ Function Publish-ComponentConnectivityHealth {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$json,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
$allConnectivityObject = New-Object System.Collections.ArrayList
if ($PsBoundParameters.ContainsKey('failureOnly')) {
@@ -5455,8 +5485,7 @@ Function Publish-ComponentConnectivityHealth {
}
$allConnectivityObject = Convert-CssClass -htmldata $allConnectivityObject
$allConnectivityObject
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5507,12 +5536,14 @@ Function Request-VcenterAuthentication {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -5571,8 +5602,7 @@ Function Request-VcenterAuthentication {
$customObject | Sort-Object Component, Resource
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5623,12 +5653,14 @@ Function Request-NsxtAuthentication {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -5698,8 +5730,7 @@ Function Request-NsxtAuthentication {
$customObject | Sort-Object Component, Resource
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5745,11 +5776,13 @@ Function Request-NsxtTransportNodeStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -5799,8 +5832,7 @@ Function Request-NsxtTransportNodeStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5846,11 +5878,13 @@ Function Request-NsxtTransportNodeTunnelStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -5911,8 +5945,7 @@ Function Request-NsxtTransportNodeTunnelStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -5958,11 +5991,13 @@ Function Request-NsxtTier0BgpStatus {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6016,8 +6051,7 @@ Function Request-NsxtTier0BgpStatus {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6062,11 +6096,13 @@ Function Publish-VmConnectedCdrom {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6090,8 +6126,7 @@ Function Publish-VmConnectedCdrom {
$allHealthObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6129,10 +6164,12 @@ Function Request-VmConnectedCdrom {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6165,8 +6202,7 @@ Function Request-VmConnectedCdrom {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6218,12 +6254,14 @@ Function Publish-EsxiConnectionHealth {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6255,8 +6293,7 @@ Function Publish-EsxiConnectionHealth {
$allHealthObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6301,11 +6338,13 @@ Function Request-EsxiConnectionHealth {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6357,8 +6396,7 @@ Function Request-EsxiConnectionHealth {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6399,10 +6437,12 @@ Function Publish-SddcManagerFreePool {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6429,8 +6469,7 @@ Function Publish-SddcManagerFreePool {
$allConfigurationObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6471,10 +6510,12 @@ Function Request-SddcManagerFreePool {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6548,8 +6589,7 @@ Function Request-SddcManagerFreePool {
$customObject | Sort-Object Component, 'ESXi FQDN'
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6608,12 +6648,14 @@ Function Publish-EsxiAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6647,8 +6689,7 @@ Function Publish-EsxiAlert {
$allAlertObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6701,12 +6742,14 @@ Function Publish-NsxtAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6740,8 +6783,7 @@ Function Publish-NsxtAlert {
$allAlertObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6793,12 +6835,14 @@ Function Publish-VcenterAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6832,8 +6876,7 @@ Function Publish-VcenterAlert {
$allAlertObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6885,12 +6928,14 @@ Function Publish-VsanAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -6924,8 +6969,7 @@ Function Publish-VsanAlert {
$allAlertObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -6971,11 +7015,13 @@ Function Request-NsxtAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
if (($vcfNsxDetails = Get-NsxtServerDetail -fqdn $server -username $user -password $pass -domain $domain)) {
@@ -6983,7 +7029,6 @@ Function Request-NsxtAlert {
if (Test-NSXTAuthentication -server $vcfNsxDetails.fqdn -user ($vcfNsxDetails.adminUser | Select-Object -first 1) -pass ($vcfNsxDetails.adminPass | Select-Object -first 1)) {
$nsxtAlarms = Get-NsxtAlarm -fqdn $vcfNsxDetails.fqdn # Get the NSX alarms
$customObject = New-Object System.Collections.ArrayList
- # TODO: Define the YELLOW alert based on Status and Severity
foreach ($alarm in $nsxtAlarms.results) {
if ($alarm.status -eq "RESOLVED") {
$alert = "GREEN"
@@ -7059,11 +7104,13 @@ Function Request-VsanAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domain $domain)) {
@@ -7147,12 +7194,14 @@ Function Request-VcenterAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateSet("hostOnly","vsanOnly")][ValidateNotNullOrEmpty()] [String]$filterOut,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domain $domain)) {
@@ -7254,11 +7303,13 @@ Function Request-EsxiAlert {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$domain,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$failureOnly
)
+ $pass = Get-Password -User $user -Password $pass
+
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domain $domain)) {
@@ -7346,11 +7397,13 @@ Function Publish-ClusterConfiguration {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7369,8 +7422,7 @@ Function Publish-ClusterConfiguration {
$allConfigurationObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7414,12 +7466,14 @@ Function Publish-EsxiCoreDumpConfig {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$html,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific--WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7477,8 +7531,7 @@ Function Publish-EsxiCoreDumpConfig {
$allHostObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7516,10 +7569,12 @@ Function Request-ClusterConfiguration {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7554,8 +7609,7 @@ Function Request-ClusterConfiguration {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7600,11 +7654,13 @@ Function Publish-ClusterDrsRule {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7627,8 +7683,7 @@ Function Publish-ClusterDrsRule {
$allConfigurationObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7666,10 +7721,12 @@ Function Request-ClusterDrsRule {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7703,8 +7760,7 @@ Function Request-ClusterDrsRule {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7749,11 +7805,13 @@ Function Publish-ResourcePool {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7771,8 +7829,7 @@ Function Publish-ResourcePool {
$allConfigurationObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7810,10 +7867,12 @@ Function Request-ResourcePool {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7844,8 +7903,7 @@ Function Request-ResourcePool {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7890,11 +7948,13 @@ Function Publish-VmOverride {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7912,8 +7972,7 @@ Function Publish-VmOverride {
$allConfigurationObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -7951,10 +8010,12 @@ Function Request-VmOverride {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -7980,8 +8041,7 @@ Function Request-VmOverride {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -8026,11 +8086,13 @@ Function Publish-VirtualNetwork {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8048,8 +8110,7 @@ Function Publish-VirtualNetwork {
$allConfigurationObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -8087,10 +8148,12 @@ Function Request-VirtualNetwork {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8123,8 +8186,7 @@ Function Request-VirtualNetwork {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -8169,11 +8231,13 @@ Function Publish-EsxiSecurityConfiguration {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (ParameterSetName = 'All-WorkloadDomains', Mandatory = $true)] [ValidateNotNullOrEmpty()] [Switch]$allDomains,
[Parameter (ParameterSetName = 'Specific-WorkloadDomain', Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$workloadDomain
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8191,8 +8255,7 @@ Function Publish-EsxiSecurityConfiguration {
$allConfigurationObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -8230,7 +8293,7 @@ Function Request-EsxiSecurityConfiguration {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$domain
)
@@ -8261,8 +8324,7 @@ Function Request-EsxiSecurityConfiguration {
}
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -8310,10 +8372,12 @@ Function Publish-VcfSystemOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8370,8 +8434,7 @@ Function Publish-VcfSystemOverview {
$allOverviewObject
}
}
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -8412,10 +8475,12 @@ Function Request-VcfOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8448,8 +8513,7 @@ Function Request-VcfOverview {
$systemObject
}
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -8483,9 +8547,11 @@ Function Request-HardwareOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8540,8 +8606,7 @@ Function Request-HardwareOverview {
$customObject
}
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -8583,16 +8648,17 @@ Function Request-VcenterOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server -ErrorAction SilentlyContinue -ErrorVariable ErrorMessage) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass -ErrorAction SilentlyContinue -ErrorVariable ErrorMessage) {
$allWorkloadDomains = Get-VCFWorkloadDomain
$allVsphereObject = New-Object System.Collections.ArrayList
-
if (($vcfMgmtVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domainType MANAGEMENT)) {
if (Test-VsphereConnection -server $vcfMgmtVcenterDetails.fqdn) {
if (Test-VsphereAuthentication -server $vcfMgmtVcenterDetails.fqdn -user $vcfMgmtVcenterDetails.ssoAdmin -pass $vcfMgmtVcenterDetails.ssoAdminPass) {
@@ -8635,7 +8701,6 @@ Function Request-VcenterOverview {
Disconnect-VIServer -Server $vcfMgmtVcenterDetails.fqdn -Confirm:$false -WarningAction SilentlyContinue | Out-Null
}
}
-
$allVsphereObject | Sort-Object 'Domain Type', 'Domain Name'
} else {
Write-LogMessage -Type ERROR -Message "$ErrorMessage"
@@ -8643,8 +8708,7 @@ Function Request-VcenterOverview {
} else {
Write-LogMessage -Type ERROR -Message "$ErrorMessage"
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -8700,12 +8764,14 @@ Function Request-EsxiOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$subscription,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$outputCsv
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8818,8 +8884,7 @@ Function Request-EsxiOverview {
}
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -8861,10 +8926,12 @@ Function Request-ClusterOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8888,8 +8955,7 @@ Function Request-ClusterOverview {
$allClusterObject | Sort-Object 'Domain Name','Cluster Name','Domain UUID','Cluster UUID'
}
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -8930,10 +8996,12 @@ Function Request-NetworkOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -8981,8 +9049,7 @@ Function Request-NetworkOverview {
}
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -9024,10 +9091,12 @@ Function Request-VMwareAriaSuiteOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [Switch]$anonymized
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -9072,8 +9141,7 @@ Function Request-VMwareAriaSuiteOverview {
$allAriaSuiteObject
}
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -9107,9 +9175,11 @@ Function Request-ValidatedSolutionOverview {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass
)
+ $pass = Get-Password -User $user -Password $pass
+
Try {
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
@@ -9200,7 +9270,6 @@ Function Request-ValidatedSolutionOverview {
$allVvsObject += $customObject
# Validate PCA Deployment
- # TODO: Extract configadmin user and password from vRSLCM to check config in vRA
if ((Get-VCFvRA).status -eq "ACTIVE") {
$vraEnabled = "Enabled"
} else {
@@ -9232,8 +9301,7 @@ Function Request-ValidatedSolutionOverview {
$allVvsObject | Sort-Object Name
}
}
- }
- Catch {
+ } Catch {
Debug-ExceptionWriter -object $_
}
}
@@ -9248,7 +9316,7 @@ Export-ModuleMember -Function Request-ValidatedSolutionOverview
Function Test-VcfReportingPrereq {
<#
- .SYNOPSIS
+ .SYNOPSIS
Verifies that the minimum dependencies are met to run the PowerShell module.
.DESCRIPTION
@@ -9272,9 +9340,11 @@ Function Test-VcfReportingPrereq {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerFqdn,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$sddcManagerPass
)
+ $sddcManagerPass = Get-Password -user $sddcManagerUser -password $sddcManagerPass
+
Try {
Clear-Host; Write-Host ""
@@ -9465,12 +9535,15 @@ Function Invoke-SddcCommand {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$vmUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$vmPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$vmPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$command
)
+ $pass = Get-Password -User $user -Password $pass
+ $vmPass = Get-Password -User $vmUser -Password $vmPass
+
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domainType MANAGEMENT)) {
@@ -9532,13 +9605,16 @@ Function Copy-FiletoSddc {
Param (
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$server,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$user,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$pass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$pass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$vmUser,
- [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$vmPass,
+ [Parameter (Mandatory = $false)] [ValidateNotNullOrEmpty()] [String]$vmPass,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$source,
[Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$destination
)
+ $pass = Get-Password -User $user -Password $pass
+ $vmPass = Get-Password -User $vmUser -Password $vmPass
+
if (Test-VCFConnection -server $server) {
if (Test-VCFAuthentication -server $server -user $user -pass $pass) {
if (($vcfVcenterDetails = Get-vCenterServerDetail -server $server -user $user -pass $pass -domainType MANAGEMENT)) {
@@ -10055,13 +10131,11 @@ Function Format-DfStorageHealth {
{ $_ -ge $redThreshold } {
$alert = 'RED' # Red if $usage is equal or above $redThreshold
$message = "Used space is above $redThreshold%. Please reclaim space on the partition."
- # TODO: Find how to display the message in html on multiple rows (Add
with the right escape chars)
# In order to display usage, you could run as root in SDDC Manager 'du -Sh | sort -rh | head -10' "
# As an alternative you could run PowerCLI commandlet:
# 'Invoke-SddcCommand -server -user -pass -GuestUser root -vmPass -command "du -Sh | sort -rh | head -10" '
}
Default {
- # TODO: Same as above - add hints on new lines }
$alert = 'YELLOW' # Yellow if above two are not matched
$message = "Used space is between $greenThreshold% and $redThreshold%. Please consider reclaiming some space on the partition."
}
@@ -10082,8 +10156,7 @@ Function Format-DfStorageHealth {
$customObject += $userObject # Creating collection to work with afterwords
}
$customObject | Sort-Object FQDN # Return $customObject in HTML or pain format
- }
- Catch {
+ } Catch {
Debug-CatchWriter -object $_
}
}
@@ -10171,8 +10244,7 @@ Function Format-StorageThreshold {
$thresholdObject | Add-Member -notepropertyname 'alert' -notepropertyvalue $alert
$thresholdObject | Add-Member -notepropertyname 'message' -notepropertyvalue $message
$thresholdObject
- }
- Catch {
+ } Catch {
Write-Error $_.Exception.Message
}
}