From 2b059265f44c2c82ebd18756ee981c0c9c3d3729 Mon Sep 17 00:00:00 2001 From: Gary Blake <31245616+GaryJBlake@users.noreply.github.com> Date: Mon, 16 Oct 2023 14:29:10 +0100 Subject: [PATCH] fix: `Add-vCenterGlobalPermission` (#376) Fixed `Add-vCenterGlobalPermission` where `-localDomain` switch was always set to `false`. Signed-off-by: Gary Blake --- PowerValidatedSolutions.psd1 | 2 +- PowerValidatedSolutions.psm1 | 6 +++--- SampleScripts/iam/iamConfigureNsx.ps1 | 2 -- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/PowerValidatedSolutions.psd1 b/PowerValidatedSolutions.psd1 index fbc52b38..c48eebb8 100644 --- a/PowerValidatedSolutions.psd1 +++ b/PowerValidatedSolutions.psd1 @@ -12,7 +12,7 @@ RootModule = 'PowerValidatedSolutions.psm1' # Version number of this module. - ModuleVersion = '2.7.0.1014' + ModuleVersion = '2.7.0.1015' # Supported PSEditions # CompatiblePSEditions = @() diff --git a/PowerValidatedSolutions.psm1 b/PowerValidatedSolutions.psm1 index 52a28182..c6453a7e 100644 --- a/PowerValidatedSolutions.psm1 +++ b/PowerValidatedSolutions.psm1 @@ -13348,14 +13348,14 @@ Function Add-vCenterGlobalPermission { [Parameter (Mandatory = $true)] [ValidateNotNullOrEmpty()] [String]$role, [Parameter (Mandatory = $true)] [ValidateSet("true", "false")] [String]$propagate, [Parameter (Mandatory = $true)] [ValidateSet("group", "user")] [String]$type, - [Parameter (Mandatory = $false)] [Switch]$localDomain = $false + [Parameter (Mandatory = $false)] [Switch]$localDomain ) Try { - if (!$localDomain){ + if (!$localDomain) { $checkAdAuthentication = Test-ADAuthentication -user $domainBindUser -pass $domainBindPass -server $domain -domain $domain -ErrorAction SilentlyContinue $securePass = ConvertTo-SecureString -String $domainBindPass -AsPlainText -Force - $domainCreds = New-Object System.Management.Automation.PSCredential ($domainBindUser, $securePass) + $domainCreds = New-Object System.Management.Automation.PSCredential ($domainBindUser, $securePass) if (!($checkAdAuthentication[1] -match "Authentication Successful")) { Write-Error "Unable to authenticate to Active Directory with user ($domainBindUser) and password ($domainBindPass), check details: PRE_VALIDTION_FAILED" Return diff --git a/SampleScripts/iam/iamConfigureNsx.ps1 b/SampleScripts/iam/iamConfigureNsx.ps1 index eead3a97..031ef384 100644 --- a/SampleScripts/iam/iamConfigureNsx.ps1 +++ b/SampleScripts/iam/iamConfigureNsx.ps1 @@ -75,8 +75,6 @@ Try { $pvsModulePath = (Get-InstalledModule -Name PowerValidatedSolutions).InstalledLocation $allWorkloadDomains = Get-VCFWorkloadDomain $domainFqdn = $pnpWorkbook.Workbook.Names["region_ad_child_fqdn"].Value - $domainBindUser = $pnpWorkbook.Workbook.Names["child_svc_vsphere_ad_user"].Value - $domainBindPass = $pnpWorkbook.Workbook.Names["child_svc_vsphere_ad_password"].Value $mgmtSddcDomainName = $pnpWorkbook.Workbook.Names["mgmt_sddc_domain"].Value $wldSddcDomainName = $pnpWorkbook.Workbook.Names["wld_sddc_domain"].Value $wsaFqdn = $pnpWorkbook.Workbook.Names["region_wsa_fqdn"].Value