fixes for podfederations and sites
This commit is contained in:
@@ -10249,7 +10249,7 @@ function register-hvpod {
|
|||||||
Registers a pod in a Horizon View Pod Federation. You have to be connected to the pod you are joining to the federation.
|
Registers a pod in a Horizon View Pod Federation. You have to be connected to the pod you are joining to the federation.
|
||||||
|
|
||||||
.PARAMETER ADUserName
|
.PARAMETER ADUserName
|
||||||
User principal name of user
|
User principal name of user this is required to be in the domain\username format
|
||||||
|
|
||||||
.PARAMETER remoteconnectionserver
|
.PARAMETER remoteconnectionserver
|
||||||
Servername of a connectionserver that already belongs to the PodFederation
|
Servername of a connectionserver that already belongs to the PodFederation
|
||||||
@@ -10296,8 +10296,8 @@ function register-hvpod {
|
|||||||
[String]
|
[String]
|
||||||
$ADUserName,
|
$ADUserName,
|
||||||
|
|
||||||
[Parameter(Mandatory = $false)]
|
[Parameter(Mandatory = $true)]
|
||||||
[SecureString]
|
[securestring]
|
||||||
$ADpassword,
|
$ADpassword,
|
||||||
|
|
||||||
[Parameter(Mandatory = $false)]
|
[Parameter(Mandatory = $false)]
|
||||||
@@ -10311,16 +10311,18 @@ function register-hvpod {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$ADPassword) {
|
#if ($ADPassword -eq $null) {
|
||||||
$ADPassword= Read-Host 'Please provide the Active Directory password for user $AdUsername' -AsSecureString
|
#$ADPassword= Read-Host 'Please provide the Active Directory password for user $AdUsername' -AsSecureString
|
||||||
}
|
#}
|
||||||
|
|
||||||
#$unsecurepassword=$ADPassword | ConvertFrom-SecureString
|
$temppw = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($ADPassword)
|
||||||
|
$PlainPassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($temppw)
|
||||||
|
$plainpassword
|
||||||
$vcPassword = New-Object VMware.Hv.SecureString
|
$vcPassword = New-Object VMware.Hv.SecureString
|
||||||
$enc = [system.Text.Encoding]::UTF8
|
$enc = [system.Text.Encoding]::UTF8
|
||||||
$vcPassword.Utf8String = $enc.GetBytes(($ADPassword | ConvertFrom-SecureString))
|
$vcPassword.Utf8String = $enc.GetBytes($PlainPassword)
|
||||||
|
|
||||||
$services.PodFederation.PodFederation_join($remoteconnectionserver,$user,$svcpassword)
|
$services.PodFederation.PodFederation_join($remoteconnectionserver,$adusername,$vcpassword)
|
||||||
write-host "This pod has been joined to the podfederation."
|
write-host "This pod has been joined to the podfederation."
|
||||||
|
|
||||||
[System.gc]::collect()
|
[System.gc]::collect()
|
||||||
@@ -10373,9 +10375,9 @@ function unregister-hvpod {
|
|||||||
[string]
|
[string]
|
||||||
$PodName,
|
$PodName,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $false)]
|
||||||
[switch]
|
[bool]
|
||||||
$force=$false,
|
$force,
|
||||||
|
|
||||||
[Parameter(Mandatory = $false)]
|
[Parameter(Mandatory = $false)]
|
||||||
$HvServer = $null
|
$HvServer = $null
|
||||||
@@ -10657,8 +10659,8 @@ function set-hvsite {
|
|||||||
$siteid=$services1.site.site_list() | where-object {$_.base.displayname -like $sitename}
|
$siteid=$services1.site.site_list() | where-object {$_.base.displayname -like $sitename}
|
||||||
$siteservice=new-object vmware.hv.siteservice
|
$siteservice=new-object vmware.hv.siteservice
|
||||||
$sitebasehelper=$siteservice.read($services, $siteid.id)
|
$sitebasehelper=$siteservice.read($services, $siteid.id)
|
||||||
$sitebasehelper.displayname=$name
|
$sitebasehelper.getbasehelper().setdisplayname($name)
|
||||||
$sitebasehelper.description=$description
|
$sitebasehelper.getbasehelper().setdescription($description)
|
||||||
$siteservice.update($services, $sitebasehelper)
|
$siteservice.update($services, $sitebasehelper)
|
||||||
|
|
||||||
[System.gc]::collect()
|
[System.gc]::collect()
|
||||||
@@ -10714,7 +10716,7 @@ function remove-hvsite {
|
|||||||
Write-Error "Could not retrieve ViewApi services from connection object"
|
Write-Error "Could not retrieve ViewApi services from connection object"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
$siteid=$services1.site.site_list() | where-object {$_.base.displayname -like $sitename}
|
$siteid=$services1.site.site_list() | where-object {$_.base.displayname -like $name}
|
||||||
$services.site.site_delete($siteid.id)
|
$services.site.site_delete($siteid.id)
|
||||||
|
|
||||||
[System.gc]::collect()
|
[System.gc]::collect()
|
||||||
|
|||||||
Reference in New Issue
Block a user