Merge pull request #225 from Magneet/master

Added functions & fixes
This commit is contained in:
Kyle Ruddy
2018-09-21 12:58:21 -04:00
committed by GitHub

View File

@@ -3568,30 +3568,35 @@ function New-HVPool {
[string[]]
$ConnectionServerRestrictions,
#desktopSpec.desktopSettings.logoffSettings.powerPloicy
#desktopSpec.desktopSettings.logoffSettings.powerPolicy
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[ValidateSet('TAKE_NO_POWER_ACTION', 'ALWAYS_POWERED_ON', 'SUSPEND', 'POWER_OFF')]
[string]$PowerPolicy = 'TAKE_NO_POWER_ACTION',
#desktopSpec.desktopSettings.logoffSettings.powerPloicy
#desktopSpec.desktopSettings.logoffSettings.powerPolicy
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[ValidateSet('IMMEDIATELY', 'NEVER', 'AFTER')]
[string]$AutomaticLogoffPolicy = 'NEVER',
#desktopSpec.desktopSettings.logoffSettings.automaticLogoffMinutes
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[ValidateRange(1,[int]::MaxValue)]
[int]$AutomaticLogoffMinutes = 120,
#desktopSpec.desktopSettings.logoffSettings.allowUsersToResetMachines
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[boolean]$allowUsersToResetMachines = $false,
#desktopSpec.desktopSettings.logoffSettings.allowMultipleSessionsPerUser
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[boolean]$allowMultipleSessionsPerUser = $false,
#desktopSpec.desktopSettings.logoffSettings.deleteOrRefreshMachineAfterLogoff
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[ValidateSet('NEVER', 'DELETE', 'REFRESH')]
[string]$deleteOrRefreshMachineAfterLogoff = 'NEVER',
@@ -3612,25 +3617,30 @@ function New-HVPool {
#DesktopDisplayProtocolSettings
#desktopSpec.desktopSettings.logoffSettings.supportedDisplayProtocols
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[ValidateSet('RDP', 'PCOIP', 'BLAST')]
[string[]]$supportedDisplayProtocols = @('RDP', 'PCOIP', 'BLAST'),
#desktopSpec.desktopSettings.logoffSettings.defaultDisplayProtocol
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[ValidateSet('RDP', 'PCOIP', 'BLAST')]
[string]$defaultDisplayProtocol = 'PCOIP',
#desktopSpec.desktopSettings.logoffSettings.allowUsersToChooseProtocol
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[int]$allowUsersToChooseProtocol = $true,
#desktopSpec.desktopSettings.logoffSettings.enableHTMLAccess
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[boolean]$enableHTMLAccess = $false,
# DesktopPCoIPDisplaySettings
#desktopSpec.desktopSettings.logoffSettings.pcoipDisplaySettings.renderer3D
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[ValidateSet('MANAGE_BY_VSPHERE_CLIENT', 'AUTOMATIC', 'SOFTWARE', 'HARDWARE', 'DISABLED')]
[string]$renderer3D = 'DISABLED',
@@ -3725,7 +3735,7 @@ function New-HVPool {
[string]
$ResourcePool,
#desktopSpec.automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterProvisioningData.datacenter if LINKED_CLONE, INSTANT_CLONE, FULL_CLONE
#desktopSpec.automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterProvisioningData.datacenter if LINKED_CLONE, INSTANT_CLONE, FULL_CLONE
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = 'FULL_CLONE')]
@@ -3739,7 +3749,7 @@ function New-HVPool {
[string[]]
$Datastores,
#desktopSpec.automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterStorageSettings.datastores.storageOvercommit if LINKED_CLONE, INSTANT_CLONE, FULL_CLONE
#desktopSpec.automatedDesktopSpec.virtualCenterProvisioningSettings.virtualCenterStorageSettings.datastores.storageOvercommit if LINKED_CLONE, INSTANT_CLONE, FULL_CLONE
[Parameter(Mandatory = $false,ParameterSetName = "LINKED_CLONE")]
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = 'FULL_CLONE')]
@@ -3980,7 +3990,8 @@ function New-HVPool {
[string]
$CustType,
#desktopSpec.automatedDesktopSpec.customizationSettings.reusePreExistingAccounts if LINKED_CLONE
#desktopSpec.automatedDesktopSpec.customizationSettings.reusePreExistingAccounts if LINKED_CLONE, INSTANT_CLONE
[Parameter(Mandatory = $false,ParameterSetName = 'INSTANT_CLONE')]
[Parameter(Mandatory = $false,ParameterSetName = 'LINKED_CLONE')]
[Boolean]
$ReusePreExistingAccounts = $false,
@@ -5211,6 +5222,7 @@ function Get-HVPoolCustomizationSetting {
throw "No Instant Clone Engine Domain Administrator found with netBiosName: [$netBiosName]"
}
$desktopSpecObj.AutomatedDesktopSpec.CustomizationSettings.CloneprepCustomizationSettings = Get-CustomizationObject
$desktopSpecObj.AutomatedDesktopSpec.CustomizationSettings.ReusePreExistingAccounts = $reusePreExistingAccounts
$desktopSpecObj.AutomatedDesktopSpec.CustomizationSettings.CloneprepCustomizationSettings.InstantCloneEngineDomainAdministrator = $instantCloneEngineDomainAdministrator
$desktopSpecObj.AutomatedDesktopSpec.CustomizationSettings.CloneprepCustomizationSettings.powerOffScriptName = $powerOffScriptName
$desktopSpecObj.AutomatedDesktopSpec.CustomizationSettings.CloneprepCustomizationSettings.powerOffScriptParameters = $powerOffScriptParameters
@@ -11352,4 +11364,118 @@ function Clear-HVEventDatabase {
}
}
Export-ModuleMember Add-HVDesktop,Add-HVRDSServer,Connect-HVEvent,Disconnect-HVEvent,Get-HVPoolSpec,Get-HVInternalName, Get-HVEvent,Get-HVFarm,Get-HVFarmSummary,Get-HVPool,Get-HVPoolSummary,Get-HVMachine,Get-HVMachineSummary,Get-HVQueryResult,Get-HVQueryFilter,New-HVFarm,New-HVPool,Remove-HVFarm,Remove-HVPool,Set-HVFarm,Set-HVPool,Start-HVFarm,Start-HVPool,New-HVEntitlement,Get-HVEntitlement,Remove-HVEntitlement, Set-HVMachine, New-HVGlobalEntitlement, Remove-HVGlobalEntitlement, Get-HVGlobalEntitlement, Set-HVApplicationIcon, Remove-HVApplicationIcon, Get-HVGlobalSettings, Set-HVGlobalSettings, Set-HVGlobalEntitlement, Get-HVResourceStructure, Get-HVLocalSession, Get-HVGlobalSession, Reset-HVMachine, Remove-HVMachine, Get-HVHealth, New-HVPodfederation, Remove-HVPodFederation, Get-HVPodFederation, Register-HVPod, Unregister-HVPod, Set-HVPodFederation,Get-HVSite,New-HVSite,Set-HVSite,Remove-HVSite,New-HVHomeSite,Get-HVHomeSite,Set-HVEventDatabase,Get-HVEventDatabase,Clear-HVEventDatabase
function Set-HVlicense {
<#
.Synopsis
Sets or changes the license for Horizon View
.DESCRIPTION
Sets or changes the license for Horizon View
.PARAMETER license
License key (string)
.PARAMETER HvServer
Reference to Horizon View Server to query the virtual machines from. If the value is not passed or null then
first element from global:DefaultHVServers would be considered in-place of hvServer
.EXAMPLE
set-hvlicense -license "LICENSE-KEY"
Returns information about the sites within a Horizon View Pod Federation.
.NOTES
Author : Wouter Kursten
Author email : wouter@retouw.nl
Version : 1.0
===Tested Against Environment====
Horizon View Server Version : 7.4,7.5
PowerCLI Version : PowerCLI 10
PowerShell Version : 5.0
#>
[CmdletBinding(
SupportsShouldProcess = $false,
ConfirmImpact = 'High'
)]
param(
[Parameter(Mandatory = $true)]
[string]
$license,
[Parameter(Mandatory = $false)]
$HvServer = $null
)
$services = Get-ViewAPIService -hvServer $hvServer
if ($null -eq $services) {
Write-Error "Could not retrieve ViewApi services from connection object"
break
}
try {
$services.license.license_set($license)
}
catch {
write-error $_.exception message
break
}
$licenseresult=$services.license.license_get()
return $licenseresult
[System.gc]::collect()
}
function Get-HVlicense {
<#
.Synopsis
Gets the license for Horizon View
.DESCRIPTION
Gets the license for Horizon View
.PARAMETER HvServer
Reference to Horizon View Server to query the virtual machines from. If the value is not passed or null then
first element from global:DefaultHVServers would be considered in-place of hvServer
.EXAMPLE
get-hvlicense
.NOTES
Author : Wouter Kursten
Author email : wouter@retouw.nl
Version : 1.0
===Tested Against Environment====
Horizon View Server Version : 7.4,7.5
PowerCLI Version : PowerCLI 10
PowerShell Version : 5.0
#>
[CmdletBinding(
SupportsShouldProcess = $false,
ConfirmImpact = 'High'
)]
param(
[Parameter(Mandatory = $false)]
$HvServer = $null
)
$services = Get-ViewAPIService -hvServer $hvServer
if ($null -eq $services) {
Write-Error "Could not retrieve ViewApi services from connection object"
break
}
$license=$services.license.license_get()
return $license
[System.gc]::collect()
}
Export-ModuleMember Add-HVDesktop,Add-HVRDSServer,Connect-HVEvent,Disconnect-HVEvent,Get-HVPoolSpec,Get-HVInternalName, Get-HVEvent,Get-HVFarm,Get-HVFarmSummary,Get-HVPool,Get-HVPoolSummary,Get-HVMachine,Get-HVMachineSummary,Get-HVQueryResult,Get-HVQueryFilter,New-HVFarm,New-HVPool,Remove-HVFarm,Remove-HVPool,Set-HVFarm,Set-HVPool,Start-HVFarm,Start-HVPool,New-HVEntitlement,Get-HVEntitlement,Remove-HVEntitlement, Set-HVMachine, New-HVGlobalEntitlement, Remove-HVGlobalEntitlement, Get-HVGlobalEntitlement, Set-HVApplicationIcon, Remove-HVApplicationIcon, Get-HVGlobalSettings, Set-HVGlobalSettings, Set-HVGlobalEntitlement, Get-HVResourceStructure, Get-HVLocalSession, Get-HVGlobalSession, Reset-HVMachine, Remove-HVMachine, Get-HVHealth, New-HVPodfederation, Remove-HVPodFederation, Get-HVPodFederation, Register-HVPod, Unregister-HVPod, Set-HVPodFederation,Get-HVSite,New-HVSite,Set-HVSite,Remove-HVSite,New-HVHomeSite,Get-HVHomeSite,Set-HVEventDatabase,Get-HVEventDatabase,Clear-HVEventDatabase,Get-HVlicense,Set-HVlicense