added functions

This commit is contained in:
Wouter Kursten
2018-09-17 09:39:07 +02:00
committed by GitHub
parent 21fe9a8d55
commit 5ee5c5d09a

View File

@@ -11352,4 +11352,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