Merge remote-tracking branch 'vmware/master'

This commit is contained in:
Kyle Ruddy
2017-07-06 20:12:40 -04:00
15 changed files with 1641 additions and 141 deletions

View File

@@ -72,7 +72,7 @@
$BackupJob = $BackupAPI.create($CreateSpec)
}
catch {
Write-Error $Error[0].exception.Message
throw $_.Exception.Message
}
@@ -84,6 +84,7 @@
start-sleep -seconds 5
} until ($BackupAPI.get("$($BackupJob.ID)").progress -eq 100 -or $BackupAPI.get("$($BackupJob.ID)").state -ne "INPROGRESS")
Write-Progress -Activity "Backing up VCSA" -Completed
$BackupAPI.get("$($BackupJob.ID)") | select id, progress, state
}
Else {

View File

@@ -0,0 +1,197 @@
Function Get-ContentLibrary {
<#
.NOTES
===========================================================================
Created by: William Lam
Organization: VMware
Blog: www.virtuallyghetto.com
Twitter: @lamw
===========================================================================
.DESCRIPTION
This function lists all available vSphere Content Libaries
.PARAMETER LibraryName
The name of a vSphere Content Library
.EXAMPLE
Get-ContentLibrary
.EXAMPLE
Get-ContentLibrary -LibraryName Test
#>
param(
[Parameter(Mandatory=$false)][String]$LibraryName
)
$contentLibaryService = Get-CisService com.vmware.content.library
$libaryIDs = $contentLibaryService.list()
$results = @()
foreach($libraryID in $libaryIDs) {
$library = $contentLibaryService.get($libraryId)
# Use vCenter REST API to retrieve name of Datastore that is backing the Content Library
$datastoreService = Get-CisService com.vmware.vcenter.datastore
$datastore = $datastoreService.get($library.storage_backings.datastore_id)
if(!$LibraryName) {
$libraryResult = [pscustomobject] @{
Id = $library.Id;
Name = $library.Name;
Type = $library.Type;
Description = $library.Description;
Datastore = $datastore.name;
CreationTime = $library.Creation_Time;
}
$results+=$libraryResult
} else {
if($LibraryName -eq $library.name) {
$libraryResult = [pscustomobject] @{
Name = $library.Name;
Id = $library.Id;
Type = $library.Type;
Description = $library.Description;
Datastore = $datastore.name;
CreationTime = $library.Creation_Time;
}
$results+=$libraryResult
}
}
}
$results
}
Function Get-ContentLibraryItems {
<#
.NOTES
===========================================================================
Created by: William Lam
Organization: VMware
Blog: www.virtuallyghetto.com
Twitter: @lamw
===========================================================================
.DESCRIPTION
This function lists all items within a given vSphere Content Library
.PARAMETER LibraryName
The name of a vSphere Content Library
.PARAMETER LibraryItemName
The name of a vSphere Content Library Item
.EXAMPLE
Get-ContentLibraryItems -LibraryName Test
.EXAMPLE
Get-ContentLibraryItems -LibraryName Test -LibraryItemName TinyPhotonVM
#>
param(
[Parameter(Mandatory=$true)][String]$LibraryName,
[Parameter(Mandatory=$false)][String]$LibraryItemName
)
$contentLibaryService = Get-CisService com.vmware.content.library
$libaryIDs = $contentLibaryService.list()
$results = @()
foreach($libraryID in $libaryIDs) {
$library = $contentLibaryService.get($libraryId)
if($library.name -eq $LibraryName) {
$contentLibaryItemService = Get-CisService com.vmware.content.library.item
$itemIds = $contentLibaryItemService.list($libraryID)
foreach($itemId in $itemIds) {
$item = $contentLibaryItemService.get($itemId)
if(!$LibraryItemName) {
$itemResult = [pscustomobject] @{
Name = $item.name;
Id = $item.id;
Description = $item.description;
Size = $item.size
Type = $item.type;
Version = $item.version;
MetadataVersion = $item.metadata_version;
ContentVersion = $item.content_version;
}
$results+=$itemResult
} else {
if($LibraryItemName -eq $item.name) {
$itemResult = [pscustomobject] @{
Name = $item.name;
Id = $item.id;
Description = $item.description;
Size = $item.size
Type = $item.type;
Version = $item.version;
MetadataVersion = $item.metadata_version;
ContentVersion = $item.content_version;
}
$results+=$itemResult
}
}
}
}
}
$results
}
Function Get-ContentLibraryItemFiles {
<#
.NOTES
===========================================================================
Created by: William Lam
Organization: VMware
Blog: www.virtuallyghetto.com
Twitter: @lamw
===========================================================================
.DESCRIPTION
This function lists all item files within a given vSphere Content Library
.PARAMETER LibraryName
The name of a vSphere Content Library
.PARAMETER LibraryItemName
The name of a vSphere Content Library Item
.EXAMPLE
Get-ContentLibraryItemFiles -LibraryName Test
.EXAMPLE
Get-ContentLibraryItemFiles -LibraryName Test -LibraryItemName TinyPhotonVM
#>
param(
[Parameter(Mandatory=$true)][String]$LibraryName,
[Parameter(Mandatory=$false)][String]$LibraryItemName
)
$contentLibaryService = Get-CisService com.vmware.content.library
$libaryIDs = $contentLibaryService.list()
$results = @()
foreach($libraryID in $libaryIDs) {
$library = $contentLibaryService.get($libraryId)
if($library.name -eq $LibraryName) {
$contentLibaryItemService = Get-CisService com.vmware.content.library.item
$itemIds = $contentLibaryItemService.list($libraryID)
foreach($itemId in $itemIds) {
$itemName = ($contentLibaryItemService.get($itemId)).name
$contenLibraryItemFileSerice = Get-CisService com.vmware.content.library.item.file
$files = $contenLibraryItemFileSerice.list($itemId)
foreach($file in $files) {
if(!$LibraryItemName) {
$fileResult = [pscustomobject] @{
Name = $file.name;
Version = $file.version;
Size = $file.size;
Stored = $file.cached;
}
$results+=$fileResult
} else {
if($itemName -eq $LibraryItemName) {
$fileResult = [pscustomobject] @{
Name = $file.name;
Version = $file.version;
Size = $file.size;
Stored = $file.cached;
}
$results+=$fileResult
}
}
}
}
}
}
$results
}

View File

@@ -1,50 +1,112 @@
#Created by Alan Renouf, published at https://communities.vmware.com/docs/DOC-18008
<#
.SYNOPSIS Datastore Functions
.DESCRIPTION A collection of functions to manipulate datastore Mount + Attach status
.EXAMPLE Get-Datastore | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
.EXAMPLE Get-Datastore IX2ISCSI01 | Unmount-Datastore
.EXAMPLE Get-Datastore IX2ISCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
.EXAMPLE Get-Datastore IX2iSCSI01 | Mount-Datastore
.EXAMPLE Get-Datastore IX2iSCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
.EXAMPLE Get-Datastore IX2iSCSI01 | Detach-Datastore
.EXAMPLE Get-Datastore IX2iSCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
.EXAMPLE Get-Datastore IX2iSCSI01 | Attach-datastore
.EXAMPLE Get-Datastore IX2iSCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
.NOTES Written by Alan Renouf, originally published at https://blogs.vmware.com/vsphere/2012/01/automating-datastore-storage-device-detachment-in-vsphere-5.html
.NOTES May 2017: Modified by Jason Coleman (virtuallyjason.blogspot.com), to improve performance when dealing with a large number of hosts and datastores
#>
Function Get-HostViews {
[CmdletBinding()]
Param (
$Datastore
)
Begin{
$allDatastores = @()
}
Process {
$allDatastores += $Datastore
}
End {
#Build the array of Datastore Objects
if (-not $Datastore) {
$allDatastores = Get-Datastore
}
$allDatastores = $allDatastores | ? {$_.pstypenames -contains "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreImpl"}
if (-not $allDatastores){
Throw "No Datastores found.`nIs ""$Datastore"" a Datastore Object?"
}
$allHosts = @()
$DShostsKeys = $allDatastores.extensiondata.host.key.value | sort | get-unique -asstring
$DShosts = foreach ($thisKey in $DShostsKeys) {($allDatastores.extensiondata.host | ? {$_.key.value -eq $thisKey})[0]}
$i = 1
foreach ($DSHost in $DSHosts){
write-progress -activity "Collecting ESXi Host Views" -status "Querying $($dshost.key)..." -percentComplete ($i++/$DSHosts.count*100)
$hostObj = "" | select keyValue,hostView,storageSys
$hostObj.hostView = get-view $DSHost.key
$hostObj.keyValue = $DSHost.key.value
$hostObj.storageSys = Get-View $hostObj.hostView.ConfigManager.StorageSystem
$allHosts += $hostObj
}
write-progress -activity "Collecting ESXi Host Views" -completed
$allHosts
}
}
Function Get-DatastoreMountInfo {
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline=$true)]
$Datastore
)
#Roll back up an unrolled array from a pipeline
Begin{
$allDatastores = @()
}
Process {
$allDatastores += $Datastore
}
End {
$AllInfo = @()
#Build the array of Datastore Objects
if (-not $Datastore) {
$Datastore = Get-Datastore
$allDatastores = Get-Datastore
}
Foreach ($ds in $Datastore) {
if ($ds.ExtensionData.info.Vmfs) {
$hostviewDSDiskName = $ds.ExtensionData.Info.vmfs.extent[0].diskname
if ($ds.ExtensionData.Host) {
$attachedHosts = $ds.ExtensionData.Host
Foreach ($VMHost in $attachedHosts) {
$hostview = Get-View $VMHost.Key
$hostviewDSState = $VMHost.MountInfo.Mounted
$StorageSys = Get-View $HostView.ConfigManager.StorageSystem
$devices = $StorageSys.StorageDeviceInfo.ScsiLun
Foreach ($device in $devices) {
$Info = "" | Select Datastore, VMHost, Lun, Mounted, State
if ($device.canonicalName -eq $hostviewDSDiskName) {
$hostviewDSAttachState = ""
if ($device.operationalState[0] -eq "ok") {
$hostviewDSAttachState = "Attached"
} elseif ($device.operationalState[0] -eq "off") {
$hostviewDSAttachState = "Detached"
} else {
$hostviewDSAttachState = $device.operationalstate[0]
}
$Info.Datastore = $ds.Name
$Info.Lun = $hostviewDSDiskName
$Info.VMHost = $hostview.Name
$Info.Mounted = $HostViewDSState
$Info.State = $hostviewDSAttachState
$AllInfo += $Info
}
}
$allDatastores = $allDatastores | ? {$_.pstypenames -contains "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreImpl"}
if (-not $allDatastores){
Throw "No Datastores found.`nIs ""$Datastore"" a Datastore Object?"
}
$allDatastoreNAAs = foreach ($ds in $allDatastores) {$ds.ExtensionData.Info.vmfs.extent[0].diskname}
#Build the array of custom Host Objects
$allHosts = Get-HostViews -datastore $allDatastores
$output = @()
$i = 1
foreach ($dsHost in $allHosts){
write-progress -activity "Checking Datastore access" -status "Checking $($dshost.hostview.name)..." -percentComplete ($i++ / $allHosts.count * 100)
#Get all devices on the host that match the list of $allDatastoreNAAs
$devices = $dsHost.storagesys.StorageDeviceInfo.ScsiLun
foreach ($device in $devices){
if ($allDatastoreNAAs -contains $device.canonicalName){
#Record information about this device/host combo
$thisDatastore = $alldatastores | ? {$_.ExtensionData.Info.vmfs.extent[0].diskname -eq $device.canonicalName}
$hostviewDSAttachState = ""
if ($device.operationalState[0] -eq "ok") {
$hostviewDSAttachState = "Attached"
} elseif ($device.operationalState[0] -eq "off") {
$hostviewDSAttachState = "Detached"
} else {
$hostviewDSAttachState = $device.operationalstate[0]
}
$Info = "" | Select Datastore, VMHost, Lun, Mounted, State
$Info.VMHost = $dsHost.hostview.name
$Info.Datastore = $thisDatastore.name
$Info.Lun = $device.canonicalName
$Info.mounted = ($thisDatastore.extensiondata.host | ? {$_.key.value -eq $dshost.keyvalue}).mountinfo.mounted
$Info.state = $hostviewDSAttachState
$output += $info
}
}
}
$AllInfo
write-progress -activity "Checking Datastore access" -completed
$output
}
}
@@ -54,81 +116,32 @@ Function Detach-Datastore {
[Parameter(ValueFromPipeline=$true)]
$Datastore
)
Process {
if (-not $Datastore) {
Write-Host "No Datastore defined as input"
Exit
}
Foreach ($ds in $Datastore) {
$hostviewDSDiskName = $ds.ExtensionData.Info.vmfs.extent[0].Diskname
if ($ds.ExtensionData.Host) {
$attachedHosts = $ds.ExtensionData.Host
Foreach ($VMHost in $attachedHosts) {
$hostview = Get-View $VMHost.Key
$StorageSys = Get-View $HostView.ConfigManager.StorageSystem
$devices = $StorageSys.StorageDeviceInfo.ScsiLun
Foreach ($device in $devices) {
if ($device.canonicalName -eq $hostviewDSDiskName) {
$LunUUID = $Device.Uuid
Write-Host "Detaching LUN $($Device.CanonicalName) from host $($hostview.Name)..."
$StorageSys.DetachScsiLun($LunUUID);
}
}
}
}
}
Begin{
$allDatastores = @()
}
}
Function Unmount-Datastore {
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline=$true)]
$Datastore
)
Process {
if (-not $Datastore) {
Write-Host "No Datastore defined as input"
Exit
}
Foreach ($ds in $Datastore) {
$hostviewDSDiskName = $ds.ExtensionData.Info.vmfs.extent[0].Diskname
if ($ds.ExtensionData.Host) {
$attachedHosts = $ds.ExtensionData.Host
Foreach ($VMHost in $attachedHosts) {
$hostview = Get-View $VMHost.Key
$StorageSys = Get-View $HostView.ConfigManager.StorageSystem
Write-Host "Unmounting VMFS Datastore $($DS.Name) from host $($hostview.Name)..."
$StorageSys.UnmountVmfsVolume($DS.ExtensionData.Info.vmfs.uuid);
}
}
}
$allDatastores += $Datastore
}
}
Function Mount-Datastore {
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline=$true)]
$Datastore
)
Process {
if (-not $Datastore) {
Write-Host "No Datastore defined as input"
Exit
End {
$allDatastores = $allDatastores | ? {$_.pstypenames -contains "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreImpl"}
if (-not $allDatastores){
Throw "No Datastores found.`nIs ""$Datastore"" a Datastore Object?"
}
Foreach ($ds in $Datastore) {
$hostviewDSDiskName = $ds.ExtensionData.Info.vmfs.extent[0].Diskname
if ($ds.ExtensionData.Host) {
$attachedHosts = $ds.ExtensionData.Host
Foreach ($VMHost in $attachedHosts) {
$hostview = Get-View $VMHost.Key
$StorageSys = Get-View $HostView.ConfigManager.StorageSystem
Write-Host "Mounting VMFS Datastore $($DS.Name) on host $($hostview.Name)..."
$StorageSys.MountVmfsVolume($DS.ExtensionData.Info.vmfs.uuid);
}
$allDatastoreNAAs = foreach ($ds in $allDatastores) {$ds.ExtensionData.Info.vmfs.extent[0].diskname}
$allHosts = Get-HostViews -datastore $allDatastores
$j = 1
foreach ($dsHost in $allHosts){
#Get all devices on the host that match the list of $allDatastoreNAAs
write-progress -id 1 -activity "Detaching Datastores" -status "Removing device(s) from $($dsHost.hostview.name)" -percentComplete ($j++ / $allHosts.count * 100)
$devices = $dsHost.storagesys.StorageDeviceInfo.ScsiLun | ? {$allDatastoreNAAs -contains $_.canonicalName}
$i = 1
foreach ($device in $devices){
write-progress -parentid 1 -activity "Detaching Datastores" -status "Removing device: $(($allDatastores | ? {$_.ExtensionData.Info.vmfs.extent[0].diskname -eq $device.canonicalName}).name)" -percentComplete ($i++ / $allDatastoreNAAs.count * 100)
$LunUUID = $Device.Uuid
$dsHost.storageSys.DetachScsiLun($LunUUID);
}
}
write-progress -activity "Detaching Datastores" -completed
}
}
@@ -138,47 +151,95 @@ Function Attach-Datastore {
[Parameter(ValueFromPipeline=$true)]
$Datastore
)
Begin{
$allDatastores = @()
}
Process {
if (-not $Datastore) {
Write-Host "No Datastore defined as input"
Exit
$allDatastores += $Datastore
}
End {
$allDatastores = $allDatastores | ? {$_.pstypenames -contains "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreImpl"}
if (-not $allDatastores){
Throw "No Datastores found.`nIs ""$Datastore"" a Datastore Object?"
}
Foreach ($ds in $Datastore) {
$hostviewDSDiskName = $ds.ExtensionData.Info.vmfs.extent[0].Diskname
if ($ds.ExtensionData.Host) {
$attachedHosts = $ds.ExtensionData.Host
Foreach ($VMHost in $attachedHosts) {
$hostview = Get-View $VMHost.Key
$StorageSys = Get-View $HostView.ConfigManager.StorageSystem
$devices = $StorageSys.StorageDeviceInfo.ScsiLun
Foreach ($device in $devices) {
if ($device.canonicalName -eq $hostviewDSDiskName) {
$LunUUID = $Device.Uuid
Write-Host "Attaching LUN $($Device.CanonicalName) to host $($hostview.Name)..."
$StorageSys.AttachScsiLun($LunUUID);
}
}
$allDatastoreNAAs = foreach ($ds in $allDatastores) {$ds.ExtensionData.Info.vmfs.extent[0].diskname}
$allHosts = Get-HostViews -datastore $allDatastores
$j = 1
foreach ($dsHost in $allHosts){
#Get all devices on the host that match the list of $allDatastoreNAAs
write-progress -id 1 -activity "Attaching Datastores" -status "Attaching devices to $($dsHost.hostview.name)" -percentComplete ($j++ / $allHosts.count * 100)
$devices = $dsHost.storagesys.StorageDeviceInfo.ScsiLun
$i = 1
foreach ($device in $devices){
write-progress -parentid 1 -activity "Attaching Datastores" -status "Attaching device: $($Device.Uuid)" -percentComplete ($i++ / $devices.count * 100)
if ($allDatastoreNAAs -contains $device.canonicalName){
$LunUUID = $Device.Uuid
$dsHost.storageSys.AttachScsiLun($LunUUID);
}
}
}
write-progress -activity "Attaching Datastores" -completed
}
}
Function Unmount-Datastore {
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline=$true)]
$Datastore
)
Begin{
$allDatastores = @()
}
Process {
$allDatastores += $Datastore
}
End {
$allDatastores = $allDatastores | ? {$_.pstypenames -contains "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreImpl"}
if (-not $allDatastores){
Throw "No Datastores found.`nIs ""$Datastore"" a Datastore Object?"
}
$allHosts = Get-HostViews -datastore $allDatastores
$j = 1
foreach ($dsHost in $allHosts){
write-progress -id 1 -activity "Unmounting Datastores" -status "Unmounting devices from $($dsHost.hostview.name)" -percentComplete ($j++ / $allHosts.count * 100)
$i = 1
foreach ($ds in $allDatastores){
write-progress -parentid 1 -activity "Unmounting Datastores" -status "Unmounting device: $($ds.name)" -percentComplete ($i++ / $allDatastores.count * 100)
$dsHost.storageSys.UnmountVmfsVolume($DS.ExtensionData.Info.vmfs.uuid);
}
}
write-progress -activity "Unmounting Datastores" -completed
}
}
Function Mount-Datastore {
[CmdletBinding()]
Param (
[Parameter(ValueFromPipeline=$true)]
$Datastore
)
Begin{
$allDatastores = @()
}
Process {
$allDatastores += $Datastore
}
End {
$allDatastores = $allDatastores | ? {$_.pstypenames -contains "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.DatastoreImpl"}
if (-not $allDatastores){
Throw "No Datastores found.`nIs ""$Datastore"" a Datastore Object?"
}
$allHosts = Get-HostViews -datastore $allDatastores
$j = 0
foreach ($dsHost in $allHosts){
write-progress -activity "Mounting Datastores" -status "Mounting devices to $($dsHost.hostview.name)" -percentComplete ($j++ / $allHosts.count * 100)
$i = 1
foreach ($ds in $allDatastores){
write-progress -activity "Mounting Datastores" -status "Mounting device: $($DS.ExtensionData.Info.vmfs.uuid)" -percentComplete ($i++ / $allDatastores.count * 100)
$dsHost.storageSys.MountVmfsVolume($DS.ExtensionData.Info.vmfs.uuid);
}
}
write-progress -activity "Mounting Datastores" -completed
}
}
#
#Get-Datastore | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
#
#Get-Datastore IX2ISCSI01 | Unmount-Datastore
#
#Get-Datastore IX2ISCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
#
#Get-Datastore IX2iSCSI01 | Mount-Datastore
#
#Get-Datastore IX2iSCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
#
#Get-Datastore IX2iSCSI01 | Detach-Datastore
#
#Get-Datastore IX2iSCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
#
#Get-Datastore IX2iSCSI01 | Attach-datastore
#
#Get-Datastore IX2iSCSI01 | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize
#

View File

@@ -0,0 +1,23 @@
VMware-vCD-Module PowerShell Module
===================================
![Invoke-MyOnBoarding](/media/Invoke-MyOnBoarding.png)
# About
## Project Owner:
Markus Kraus [@vMarkus_K](https://twitter.com/vMarkus_K)
## Project WebSite:
[mycloudrevolution.com](http://mycloudrevolution.com/)
## Project Documentation:
[Read the Docs](http://vmware-vcd-module.readthedocs.io/)
## Project Description:
The 'VMware-vCD-Module' PowerShell Module is focused on the initial craation of VMware vCloud Director Objects like Org, Org User, Org VDC.

View File

@@ -0,0 +1,126 @@
#
# Modulmanifest für das Modul "PSGet_VMware-vCD-Module"
#
# Generiert von: Markus
#
# Generiert am: 6/11/2017
#
@{
# Die diesem Manifest zugeordnete Skript- oder Binärmoduldatei.
# RootModule = ''
# Die Versionsnummer dieses Moduls
ModuleVersion = '0.2.0'
# ID zur eindeutigen Kennzeichnung dieses Moduls
GUID = '1ef8a2de-ca22-4c88-8cdb-e00f35007d2a'
# Autor dieses Moduls
Author = 'Markus'
# Unternehmen oder Hersteller dieses Moduls
CompanyName = 'Unbekannt'
# Urheberrechtserklärung für dieses Modul
Copyright = '(c) 2017 Markus. Alle Rechte vorbehalten.'
# Beschreibung der von diesem Modul bereitgestellten Funktionen
# Description = ''
# Die für dieses Modul mindestens erforderliche Version des Windows PowerShell-Moduls
# PowerShellVersion = ''
# Der Name des für dieses Modul erforderlichen Windows PowerShell-Hosts
# PowerShellHostName = ''
# Die für dieses Modul mindestens erforderliche Version des Windows PowerShell-Hosts
# PowerShellHostVersion = ''
# Die für dieses Modul mindestens erforderliche Microsoft .NET Framework-Version
# DotNetFrameworkVersion = ''
# Die für dieses Modul mindestens erforderliche Version der CLR (Common Language Runtime)
# CLRVersion = ''
# Die für dieses Modul erforderliche Prozessorarchitektur ("Keine", "X86", "Amd64").
# ProcessorArchitecture = ''
# Die Module, die vor dem Importieren dieses Moduls in die globale Umgebung geladen werden müssen
# RequiredModules = @()
# Die Assemblys, die vor dem Importieren dieses Moduls geladen werden müssen
# RequiredAssemblies = @()
# Die Skriptdateien (PS1-Dateien), die vor dem Importieren dieses Moduls in der Umgebung des Aufrufers ausgeführt werden.
# ScriptsToProcess = @()
# Die Typdateien (.ps1xml), die beim Importieren dieses Moduls geladen werden sollen
# TypesToProcess = @()
# Die Formatdateien (.ps1xml), die beim Importieren dieses Moduls geladen werden sollen
# FormatsToProcess = @()
# Die Module, die als geschachtelte Module des in "RootModule/ModuleToProcess" angegebenen Moduls importiert werden sollen.
NestedModules = @('functions\Invoke-MyOnBoarding.psm1',
'functions\New-MyOrg.psm1',
'functions\New-MyOrgAdmin.psm1',
'functions\New-MyOrgVdc.psm1')
# Aus diesem Modul zu exportierende Funktionen
FunctionsToExport = 'Invoke-MyOnBoarding', 'New-MyOrg', 'New-MyOrgAdmin', 'New-MyOrgVdc'
# Aus diesem Modul zu exportierende Cmdlets
CmdletsToExport = '*'
# Die aus diesem Modul zu exportierenden Variablen
VariablesToExport = '*'
# Aus diesem Modul zu exportierende Aliase
AliasesToExport = '*'
# Aus diesem Modul zu exportierende DSC-Ressourcen
# DscResourcesToExport = @()
# Liste aller Module in diesem Modulpaket
# ModuleList = @()
# Liste aller Dateien in diesem Modulpaket
# FileList = @()
# Die privaten Daten, die an das in "RootModule/ModuleToProcess" angegebene Modul übergeben werden sollen. Diese können auch eine PSData-Hashtabelle mit zusätzlichen von PowerShell verwendeten Modulmetadaten enthalten.
PrivateData = @{
PSData = @{
# Tags applied to this module. These help with module discovery in online galleries.
# Tags = @()
# A URL to the license for this module.
# LicenseUri = ''
# A URL to the main website for this project.
# ProjectUri = ''
# A URL to an icon representing this module.
# IconUri = ''
# ReleaseNotes of this module
# ReleaseNotes = ''
# External dependent modules of this module
# ExternalModuleDependencies = ''
} # End of PSData hashtable
} # End of PrivateData hashtable
# HelpInfo-URI dieses Moduls
# HelpInfoURI = ''
# Standardpräfix für Befehle, die aus diesem Modul exportiert werden. Das Standardpräfix kann mit "Import-Module -Prefix" überschrieben werden.
# DefaultCommandPrefix = ''
}

View File

@@ -0,0 +1,24 @@
{
"Org": {
"Name":"TestOrg",
"FullName": "Test Org",
"Description":"Automation Test Org"
},
"OrgAdmin": {
"Name":"TestOrgAdmin",
"Pasword": "myPassword1!",
"FullName":"Test OrgAdmin",
"EmailAddress":"test@admin.org"
},
"OrgVdc": {
"Name":"TestOrgVdc",
"FixedSize": "M",
"CPULimit": "1000",
"MEMLimit":"1024",
"StorageLimit":"1024",
"StorageProfile":"Standard-DC01",
"ProviderVDC":"Provider-VDC-DC01",
"NetworkPool":"Provider-VDC-DC01-NetPool",
"ExternalNetwork": "External-OrgVdcNet"
}
}

View File

@@ -0,0 +1,172 @@
#Requires -Version 4
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
Function Invoke-MyOnBoarding {
<#
.SYNOPSIS
Creates all vCD Objecst for a new IAAS Customer
.DESCRIPTION
Creates all vCD Objects for a new IAAS Customer
All Objects are:
* Org
* Default Org Admin
* Org VDC
** Private Catalog
** Optional Bridged Network
JSON Config Example:
{
"Org": {
"Name":"TestOrg",
"FullName": "Test Org",
"Description":"Automation Test Org"
},
"OrgAdmin": {
"Name":"TestOrgAdmin",
"Pasword": "myPassword1!",
"FullName":"Test OrgAdmin",
"EmailAddress":"test@admin.org"
},
"OrgVdc": {
"Name":"TestOrgVdc",
"FixedSize": "M",
"CPULimit": "1000",
"MEMLimit":"1000",
"StorageLimit":"1000",
"StorageProfile":"Standard-DC01",
"ProviderVDC":"Provider-VDC-DC01",
"NetworkPool":"Provider-VDC-DC01-NetPool",
"ExternalNetwork": "External_OrgVdcNet"
}
}
.NOTES
File Name : Invoke-MyOnBoarding.ps1
Author : Markus Kraus
Version : 1.2
State : Ready
.LINK
https://mycloudrevolution.com/
.EXAMPLE
Invoke-MyOnBoarding -ConfigFile ".\OnBoarding.json" -Enabled:$true
.EXAMPLE
Invoke-MyOnBoarding -ConfigFile ".\OnBoarding.json" -Enabled:$false
.PARAMETER ConfigFile
Full Path to the JSON Config File
.PARAMETER Enabled
Should the Customer be enabled after creation
Default: $False
#>
Param (
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Full Path to the JSON Config File")]
[ValidateNotNullorEmpty()]
[String] $ConfigFile,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Should the Customer be enabled after creation")]
[ValidateNotNullorEmpty()]
[Switch]$Enabled
)
Process {
$Valid = $true
Write-Verbose "## Import JSON Config"
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Importing JSON Config...`n"
$Configs = Get-Content -Raw -Path $ConfigFile -ErrorAction Continue | ConvertFrom-Json -ErrorAction Continue
if (!($Configs)) {
$Valid = $false
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Importing JSON Config Failed" -ForegroundColor Red
}
else {
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Importing JSON Config OK" -ForegroundColor Green
}
if ($Valid) {
try{
Write-Verbose "## Create Org"
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new Org...`n" -ForegroundColor Yellow
$Trash = New-MyOrg -Name $Configs.Org.Name -FullName $Configs.Org.Fullname -Description $Configs.Org.Description -Enabled:$Enabled
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new Org OK" -ForegroundColor Green
Get-Org -Name $Configs.Org.Name | Select-Object Name, FullName, Enabled | Format-Table -AutoSize
}
catch {
$Valid = $false
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new Org Failed" -ForegroundColor Red
}
}
if ($Valid) {
try{
Write-Verbose "## Create OrgAdmin"
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new OrgAdmin...`n" -ForegroundColor Yellow
$Trash = New-MyOrgAdmin -Name $Configs.OrgAdmin.Name -Pasword $Configs.OrgAdmin.Pasword -FullName $Configs.OrgAdmin.FullName -EmailAddress $Configs.OrgAdmin.EmailAddress -Org $Configs.Org.Name -Enabled:$Enabled
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new OrgAdmin OK" -ForegroundColor Green
Get-CIUser -Org $Configs.Org.Name -Name $Configs.OrgAdmin.Name | Select-Object Name, FullName, Email | Format-Table -AutoSize
}
catch {
$Valid = $false
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new OrgAdmin Failed" -ForegroundColor Red
}
}
if ($Valid) {
try{
Write-Verbose "## Create OrgVdc"
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new OrgVdc...`n" -ForegroundColor Yellow
if ($Configs.OrgVdc.FixedSize){
Write-Host "Fixed Size (T-Shirt Size) '$($Configs.OrgVdc.FixedSize)' Org VDC Requested!"
switch ($Configs.OrgVdc.FixedSize) {
M {
[String]$CPULimit = 36000
[String]$MEMLimit = 122880
[String]$StorageLimit = 1048576
}
L {
[String]$CPULimit = 36000
[String]$MEMLimit = 245760
[String]$StorageLimit = 1048576
}
default {throw "Invalid T-Shirt Size!"}
}
}
else{
Write-Host "Custom Org VDC Size Requested!"
$CPULimit = $Configs.OrgVdc.CPULimit
$MEMLimit = $Configs.OrgVdc.MEMLimit
$StorageLimit = $Configs.OrgVdc.StorageLimit
}
if ($Configs.OrgVdc.ExternalNetwork){
$Trash = New-MyOrgVdc -Name $Configs.OrgVdc.Name -CPULimit $CPULimit -MEMLimit $MEMLimit -StorageLimit $StorageLimit -Networkpool $Configs.OrgVdc.NetworkPool -StorageProfile $Configs.OrgVdc.StorageProfile -ProviderVDC $Configs.OrgVdc.ProviderVDC -ExternalNetwork $Configs.OrgVdc.ExternalNetwork -Org $Configs.Org.Name -Enabled:$Enabled
}
else {
$Trash = New-MyOrgVdc -Name $Configs.OrgVdc.Name -CPULimit $CPULimit -MEMLimit $MEMLimit -StorageLimit $StorageLimit -Networkpool $Configs.OrgVdc.NetworkPool -StorageProfile $Configs.OrgVdc.StorageProfile -ProviderVDC $Configs.OrgVdc.ProviderVDC -Org $Configs.Org.Name -Enabled:$Enabled
}
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new OrgVdc OK" -ForegroundColor Green
Get-OrgVdc -Org $Configs.Org.Name -Name $Configs.OrgVdc.Name | Select-Object Name, Enabled, CpuAllocationGhz, MemoryLimitGB, StorageLimitGB, AllocationModel, ThinProvisioned, UseFastProvisioning, `
@{N="StorageProfile";E={$_.ExtensionData.VdcStorageProfiles.VdcStorageProfile.Name}}, `
@{N='VCpuInMhz';E={$_.ExtensionData.VCpuInMhz}} | Format-Table -AutoSize
}
catch {
$Valid = $false
Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") Creating new OrgVdc Failed" -ForegroundColor Red
}
}
Write-Output "Overall Execution was Valid: $Valid"
}
}

View File

@@ -0,0 +1,107 @@
#Requires -Version 4
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
Function New-MyOrg {
<#
.SYNOPSIS
Creates a new vCD Org with Default Parameters
.DESCRIPTION
Creates a new vCD Org with Default Parameters.
Default Parameters are:
* Catalog Publishing
* Catalog Subscription
* VM Quota
* Stored VM Quota
* VM Lease Time
* Stored VM Lease Time
* Password Policy Settings
.NOTES
File Name : New-MyOrg.ps1
Author : Markus Kraus
Version : 1.1
State : Ready
.LINK
https://mycloudrevolution.com/
.EXAMPLE
New-MyOrg -Name "TestOrg" -FullName "Test Org" -Description "PowerCLI Test Org"
.PARAMETER Name
Name of the New Org as String
.PARAMETER FullName
Full Name of the New Org as String
.PARAMETER Description
Description of the New Org as String
.PARAMETER Enabled
Should the New Org be enabled after creation
Default:$false
#>
Param (
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Name of the New Org as string")]
[ValidateNotNullorEmpty()]
[String] $Name,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Full Name of the New Org as string")]
[ValidateNotNullorEmpty()]
[String] $FullName,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Description of the New Org as string")]
[ValidateNotNullorEmpty()]
[String] $Description,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Should the New Org be enabled after creation")]
[ValidateNotNullorEmpty()]
[Switch]$Enabled
)
Process {
$vcloud = $DefaultCIServers[0].ExtensionData
## Create Objects
$AdminOrg = New-Object VMware.VimAutomation.Cloud.Views.AdminOrg
$orgGeneralSettings = New-Object VMware.VimAutomation.Cloud.Views.OrgGeneralSettings
$orgOrgLeaseSettings = New-Object VMware.VimAutomation.Cloud.Views.OrgLeaseSettings
$orgOrgVAppTemplateLeaseSettings = New-Object VMware.VimAutomation.Cloud.Views.OrgVAppTemplateLeaseSettings
$orgOrgPasswordPolicySettings = New-Object VMware.VimAutomation.Cloud.Views.OrgPasswordPolicySettings
$orgSettings = New-Object VMware.VimAutomation.Cloud.Views.OrgSettings
## Admin Settings
$adminOrg.Name = $name
$adminOrg.FullName = $FullName
$adminOrg.Description = $description
$adminOrg.IsEnabled = $Enabled
## Org Setting
### General Org Settings
$orgGeneralSettings.CanPublishCatalogs = $False
$orgGeneralSettings.CanPublishExternally = $False
$orgGeneralSettings.CanSubscribe = $True
$orgGeneralSettings.DeployedVMQuota = 0
$orgGeneralSettings.StoredVmQuota = 0
$orgSettings.OrgGeneralSettings = $orgGeneralSettings
### vApp Org Setting
$orgOrgLeaseSettings.DeleteOnStorageLeaseExpiration = $false
$orgOrgLeaseSettings.DeploymentLeaseSeconds = 0
$orgOrgLeaseSettings.StorageLeaseSeconds = 0
$orgSettings.VAppLeaseSettings = $orgOrgLeaseSettings
### vApp Template Org Setting
$orgOrgVAppTemplateLeaseSettings.DeleteOnStorageLeaseExpiration = $false
$orgOrgVAppTemplateLeaseSettings.StorageLeaseSeconds = 0
$orgSettings.VAppTemplateLeaseSettings = $orgOrgVAppTemplateLeaseSettings
### PasswordPolicySettings Org Setting
$orgOrgPasswordPolicySettings.AccountLockoutEnabled = $True
$orgOrgPasswordPolicySettings.InvalidLoginsBeforeLockout = 5
$orgOrgPasswordPolicySettings.AccountLockoutIntervalMinutes = 30
$orgSettings.OrgPasswordPolicySettings = $orgOrgPasswordPolicySettings
$adminOrg.Settings = $orgSettings
$CreateOrg = $vcloud.CreateOrg($adminOrg)
Get-Org -Name $name | Format-Table -AutoSize
}
}

View File

@@ -0,0 +1,91 @@
#Requires -Version 4
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
Function New-MyOrgAdmin {
<#
.SYNOPSIS
Creates a new vCD Org Admin with Default Parameters
.DESCRIPTION
Creates a new vCD Org Admin with Default Parameters
Default Parameters are:
* User Role
.NOTES
File Name : New-MyOrgAdmin.ps1
Author : Markus Kraus
Version : 1.1
State : Ready
.LINK
https://mycloudrevolution.com/
.EXAMPLE
New-MyOrgAdmin -Name "OrgAdmin" -Pasword "Anfang!!" -FullName "Org Admin" -EmailAddress "OrgAdmin@TestOrg.local" -Org "TestOrg"
.PARAMETER Name
Name of the New Org Admin as String
.PARAMETER FullName
Full Name of the New Org Admin as String
.PARAMETER Password
Password of the New Org Admin as String
.PARAMETER EmailAddress
EmailAddress of the New Org Admin as String
.PARAMETER Enabled
Should the New Org be enabled after creation
Default:$false
.PARAMETER Org
Org where the new Org Admin should be created as string
#>
Param (
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Name of the New Org Admin as String")]
[ValidateNotNullorEmpty()]
[String] $Name,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Password of the New Org Admin as String")]
[ValidateNotNullorEmpty()]
[String] $Pasword,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Full Name of the New Org Admin as String")]
[ValidateNotNullorEmpty()]
[String] $FullName,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="EmailAddress of the New Org Admin as String")]
[ValidateNotNullorEmpty()]
[String] $EmailAddress,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Org where the new Org Admin should be created as string")]
[ValidateNotNullorEmpty()]
[String] $Org,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Should the New Org be enabled after creation")]
[ValidateNotNullorEmpty()]
[Switch]$Enabled
)
Process {
## Create Objects
$OrgED = (Get-Org $Org).ExtensionData
$orgAdminUser = New-Object VMware.VimAutomation.Cloud.Views.User
## Settings
$orgAdminUser.Name = $Name
$orgAdminUser.FullName = $FullName
$orgAdminUser.EmailAddress = $EmailAddress
$orgAdminUser.Password = $Pasword
$orgAdminUser.IsEnabled = $Enabled
$vcloud = $DefaultCIServers[0].ExtensionData
## Find Role
$orgAdminRole = $vcloud.RoleReferences.RoleReference | Where-Object {$_.Name -eq "Organization Administrator"}
$orgAdminUser.Role = $orgAdminRole
## Create User
$user = $orgED.CreateUser($orgAdminUser)
Get-CIUser -Org $Org -Name $Name | Format-Table -AutoSize
}
}

View File

@@ -0,0 +1,252 @@
#Requires -Version 4
#Requires -Modules VMware.VimAutomation.Cloud, @{ModuleName="VMware.VimAutomation.Cloud";ModuleVersion="6.3.0.0"}
Function New-MyOrgVdc {
<#
.SYNOPSIS
Creates a new vCD Org VDC with Default Parameters
.DESCRIPTION
Creates a new vCD Org VDC with Default Parameters
Default Parameters are:
* Allocation Model
* Network Quota
* VM Quota
* 'vCpu In Mhz'
* Fast Provisioning
* Thin Provisioning
* private Catalog
.NOTES
File Name : New-MyOrgVdc.ps1
Author : Markus Kraus
Version : 1.2
State : Ready
.LINK
https://mycloudrevolution.com/
.EXAMPLE
New-MyOrgVdc -Name "TestVdc" -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg" -ExternalNetwork "External_OrgVdcNet"
.EXAMPLE
New-MyOrgVdc -Name "TestVdc" -CPULimit 1000 -MEMLimit 1000 -StorageLimit 1000 -StorageProfile "Standard-DC01" -NetworkPool "NetworkPool-DC01" -ProviderVDC "Provider-VDC-DC01" -Org "TestOrg"
.PARAMETER Name
Name of the New Org VDC as String
.PARAMETER CPULimit
CPU Limit (MHz) of the New Org VDC as String
.PARAMETER MEMLimit
Memory Limit (MB) of the New Org VDC as String
.PARAMETER StorageLimit
Storage Limit (MB) of the New Org VDC as String
.PARAMETER StorageProfile
Storage Profile of the New Org VDC as String
.PARAMETER NetworkPool
Network Pool of the New Org VDC as String
.PARAMETER ExternalNetwork
Optional External Network of the New Org VDC as String
.PARAMETER Enabled
Should the New Org VDC be enabled after creation
Default:$false
Note: If an External Network is requested the Org VDC will be enabled during External Network Configuration
.PARAMETER ProviderVDC
ProviderVDC where the new Org VDC should be created as string
.PARAMETER Org
Org where the new Org VDC should be created as string
.PARAMETER Timeout
Timeout for teh Org VDC to get Ready
Default: 120s
#>
Param (
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Name of the New Org VDC as String")]
[ValidateNotNullorEmpty()]
[String] $Name,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="CPU Limit (MHz) of the New Org VDC as String")]
[ValidateNotNullorEmpty()]
[int] $CPULimit,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Memory Limit (MB) of the New Org VDC as String")]
[ValidateNotNullorEmpty()]
[int] $MEMLimit,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Storage Limit (MB) of the New Org VDC as String")]
[ValidateNotNullorEmpty()]
[int] $StorageLimit,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Storage Profile of the New Org VDC as String")]
[ValidateNotNullorEmpty()]
[String] $StorageProfile,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Network Pool of the New Org VDC as String")]
[ValidateNotNullorEmpty()]
[String] $NetworkPool,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Optional External Network of the New Org VDC as String")]
[ValidateNotNullorEmpty()]
[String] $ExternalNetwork,
[Parameter(Mandatory=$False, ValueFromPipeline=$False, HelpMessage="Should the New Org VDC be enabled after creation")]
[ValidateNotNullorEmpty()]
[Switch]$Enabled,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="ProviderVDC where the new Org VDC should be created as string")]
[ValidateNotNullorEmpty()]
[String] $ProviderVDC,
[Parameter(Mandatory=$True, ValueFromPipeline=$False, HelpMessage="Org where the new Org VDC should be created as string")]
[ValidateNotNullorEmpty()]
[String] $Org,
[Parameter(Mandatory=$False, ValueFromPipeline=$False,HelpMessage="Timeout for teh Org VDC to get Ready")]
[ValidateNotNullorEmpty()]
[int] $Timeout = 120
)
Process {
## Create Objects and all Settings
Write-Verbose "Create Objects and all Settings"
$adminVdc = New-Object VMware.VimAutomation.Cloud.Views.AdminVdc
$adminVdc.Name = $name
$adminVdc.IsEnabled = $Enabled
$OrgVdcproviderVdc = Get-ProviderVdc $ProviderVDC
$providerVdcRef = New-Object VMware.VimAutomation.Cloud.Views.Reference
$providerVdcRef.Href = $OrgVdcproviderVdc.Href
$adminVdc.ProviderVdcReference = $providerVdcRef
$adminVdc.AllocationModel = "AllocationPool"
$adminVdc.ComputeCapacity = New-Object VMware.VimAutomation.Cloud.Views.ComputeCapacity
$adminVdc.ComputeCapacity.Cpu = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
$adminVdc.ComputeCapacity.Cpu.Units = "MHz"
$adminVdc.ComputeCapacity.Cpu.Limit = $CPULimit
$adminVdc.ComputeCapacity.Cpu.Allocated = $CPULimit
$adminVdc.ComputeCapacity.Memory = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
$adminVdc.ComputeCapacity.Memory.Units = "MB"
$adminVdc.ComputeCapacity.Memory.Limit = $MEMLimit
$adminVdc.ComputeCapacity.Memory.Allocated = $MEMLimit
$adminVdc.StorageCapacity = New-Object VMware.VimAutomation.Cloud.Views.CapacityWithUsage
$adminVdc.StorageCapacity.Units = "MB"
$adminVdc.StorageCapacity.Limit = $StorageLimit
$adminVdc.NetworkQuota = 10
$adminVdc.VmQuota = 0
$adminVdc.VCpuInMhz = 1000
$adminVdc.VCpuInMhz2 = 1000
$adminVdc.UsesFastProvisioning = $false
$adminVdc.IsThinProvision = $true
## Create Org vDC
Write-Verbose "Create Org vDC"
$OrgED = (Get-Org $Org).ExtensionData
$orgVdc = $orgED.CreateVdc($adminVdc)
## Wait for getting Ready
Write-Verbose "Wait for getting Ready"
$i = 0
while(($orgVdc = Get-OrgVdc -Name $Name).Status -eq "NotReady"){
$i++
Start-Sleep 2
if($i -gt $Timeout) { Write-Error "Creating Org Failed."; break}
Write-Progress -Activity "Creating Org" -Status "Wait for Org to become Ready..."
}
Write-Progress -Activity "Creating Org" -Completed
Start-Sleep 2
## Search given Storage Profile
Write-Verbose "Search given Storage Profile"
$ProVdcStorageProfile = search-cloud -QueryType ProviderVdcStorageProfile -Name $StorageProfile | Get-CIView
## Create Storage Profile Object with Settings
Write-Verbose "Create Storage Profile Object with Settings"
$spParams = new-object VMware.VimAutomation.Cloud.Views.VdcStorageProfileParams
$spParams.Limit = $StorageLimit
$spParams.Units = "MB"
$spParams.ProviderVdcStorageProfile = $ProVdcStorageProfile.href
$spParams.Enabled = $true
$spParams.Default = $true
$UpdateParams = new-object VMware.VimAutomation.Cloud.Views.UpdateVdcStorageProfiles
$UpdateParams.AddStorageProfile = $spParams
## Update Org vDC
$orgVdc = Get-OrgVdc -Name $name
$orgVdc.ExtensionData.CreateVdcStorageProfile($UpdateParams)
## Wait for getting Ready
Write-Verbose "Wait for getting Ready"
while(($orgVdc = Get-OrgVdc -Name $name).Status -eq "NotReady"){
$i++
Start-Sleep 1
if($i -gt $Timeout) { Write-Error "Update Org Failed."; break}
Write-Progress -Activity "Updating Org" -Status "Wait for Org to become Ready..."
}
Write-Progress -Activity "Updating Org" -Completed
Start-Sleep 1
## Search Any-StorageProfile
Write-Verbose "Search Any-StorageProfile"
$orgvDCAnyProfile = search-cloud -querytype AdminOrgVdcStorageProfile | Where-Object {($_.Name -match '\*') -and ($_.VdcName -eq $orgVdc.Name)} | Get-CIView
## Disable Any-StorageProfile
Write-Verbose "Disable Any-StorageProfile"
$orgvDCAnyProfile.Enabled = $False
$return = $orgvDCAnyProfile.UpdateServerData()
## Remove Any-StorageProfile
Write-Verbose "Remove Any-StorageProfile"
$ProfileUpdateParams = new-object VMware.VimAutomation.Cloud.Views.UpdateVdcStorageProfiles
$ProfileUpdateParams.RemoveStorageProfile = $orgvDCAnyProfile.href
$remove = $orgvdc.extensiondata.CreatevDCStorageProfile($ProfileUpdateParams)
## Wait for getting Ready
Write-Verbose "Wait for getting Ready"
while(($orgVdc = Get-OrgVdc -Name $name).Status -eq "NotReady"){
$i++
Start-Sleep 1
if($i -gt $Timeout) { Write-Error "Update Org Failed."; break}
Write-Progress -Activity "Updating Org" -Status "Wait for Org to become Ready..."
}
Write-Progress -Activity "Updating Org" -Completed
Start-Sleep 1
## Set NetworkPool for correct location
Write-Verbose "Set NetworkPool for correct location"
$orgVdc = Get-OrgVdc -Name $name
$ProVdcNetworkPool = Get-NetworkPool -ProviderVdc $ProviderVDC -Name $NetworkPool
$set = Set-OrgVdc -OrgVdc $orgVdc -NetworkPool $ProVdcNetworkPool -NetworkMaxCount "10"
## Create private Catalog
Write-Verbose "Create private Catalog Object"
$OrgCatalog = New-Object VMware.VimAutomation.Cloud.Views.AdminCatalog
$OrgCatalog.name = "$Org Private Catalog"
if (!(Get-Org $org | Get-Catalog -Name $OrgCatalog.name -ErrorAction SilentlyContinue)) {
Write-Verbose "Create private Catalog"
$CreateCatalog = (Get-Org $org | Get-CIView).CreateCatalog($OrgCatalog)
$AccessControlRule = New-CIAccessControlRule -Entity $CreateCatalog.name -EveryoneInOrg -AccessLevel ReadWrite -Confirm:$False
}
else {
Write-Output "Catalog '$($OrgCatalog.name)' aleady exists!"
}
## Create a direct connect network
if ($ExternalNetwork) {
Write-Verbose "Create a direct connect network"
Write-Output "Org VDC '$Name' needs to be enabled to add an external Network!"
$EnableOrgVdc = Set-OrgVdc -OrgVdc $Name -Enabled:$True
$orgVdcView = Get-OrgVdc $Name | Get-CIView
$extNetwork = $_.externalnetwork
$extNetwork = Get-ExternalNetwork | Get-CIView | Where-Object {$_.name -eq $ExternalNetwork}
$orgNetwork = new-object vmware.vimautomation.cloud.views.orgvdcnetwork
$orgNetwork.name = $ExternalNetwork
$orgNetwork.Configuration = New-Object VMware.VimAutomation.Cloud.Views.NetworkConfiguration
$orgNetwork.Configuration.FenceMode = 'bridged'
$orgNetwork.configuration.ParentNetwork = New-Object vmware.vimautomation.cloud.views.reference
$orgNetwork.configuration.ParentNetwork.href = $extNetwork.href
$result = $orgVdcView.CreateNetwork($orgNetwork)
}
Get-OrgVdc -Name $name | Format-Table -AutoSize
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -0,0 +1,35 @@
$moduleRoot = Resolve-Path "$PSScriptRoot\.."
$moduleName = "VMware-vCD-Module"
$ConfigFile = "$moduleRoot\examples\OnBoarding.json"
Describe "General project validation: $moduleName" {
$scripts = Get-ChildItem $moduleRoot -Include *.ps1, *.psm1, *.psd1 -Recurse
# TestCases are splatted to the script so we need hashtables
$testCase = $scripts | Foreach-Object {@{file = $_}}
It "Script <file> should be valid powershell" -TestCases $testCase {
param($file)
$file.fullname | Should Exist
$contents = Get-Content -Path $file.fullname -ErrorAction Stop
$errors = $null
$null = [System.Management.Automation.PSParser]::Tokenize($contents, [ref]$errors)
$errors.Count | Should Be 0
}
It "Module '$moduleName' prerequirements are met" {
{Import-Module VMware.VimAutomation.Cloud -Force} | Should Not Throw
}
It "Module '$moduleName' can import cleanly" {
{Import-Module (Join-Path $moduleRoot "$moduleName.psd1") -force } | Should Not Throw
}
It "Module '$moduleName' JSON example is valid" {
{Get-Content -Raw -Path $ConfigFile | ConvertFrom-Json} | Should Not Throw
}
}

View File

@@ -0,0 +1,22 @@
{
"generalData.clientMaxSessionTimePolicy": "TIMEOUT_AFTER",
"generalData.clientMaxSessionTimeMinutes": 600,
"generalData.clientIdleSessionTimeoutPolicy": "NEVER",
"generalData.clientIdleSessionTimeoutMinutes": null,
"generalData.clientSessionTimeoutMinutes": 1200,
"generalData.desktopSSOTimeoutPolicy": "DISABLE_AFTER",
"generalData.desktopSSOTimeoutMinutes": 15,
"generalData.applicationSSOTimeoutPolicy": "ALWAYS_ENABLED",
"generalData.applicationSSOTimeoutMinutes": null,
"generalData.viewAPISessionTimeoutMinutes": 10,
"generalData.preLoginMessage": null,
"generalData.displayWarningBeforeForcedLogoff": true,
"generalData.forcedLogoffTimeoutMinutes": 5,
"generalData.forcedLogoffMessage": "Your desktop is scheduled for an important update and will shut down in 5 minutes. Please save any unsaved work now",
"generalData.enableServerInSingleUserMode": false,
"generalData.storeCALOnBroker": false,
"generalData.storeCALOnClient": false,
"securityData.reauthSecureTunnelAfterInterruption": true,
"securityData.messageSecurityMode": "ENHANCED",
"securityData.enableIPSecForSecurityServerPairing": true
}

View File

@@ -8982,4 +8982,393 @@ Function Remove-HVApplicationIcon {
}
}
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, Get-HVPodSession, Set-HVApplicationIcon, Remove-HVApplicationIcon
function Get-HVGlobalSettings {
<#
.Synopsis
Gets a list of Global Settings
.DESCRIPTION
Queries and returns the Global Settings for the pod of the specified HVServer.
.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 inplace of hvServer
.EXAMPLE
Get-HVGlobalSettings
.OUTPUTS
Returns list of object type VMware.Hv.GlobalSettingsInfo
.NOTES
Author : Matt Frey.
Author email : mfrey@vmware.com
Version : 1.0
===Tested Against Environment====
Horizon View Server Version : 7.1
PowerCLI Version : PowerCLI 6.5.1
PowerShell Version : 5.0
#>
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = 'High'
)]
param(
[Parameter(Mandatory = $false)]
$HvServer = $null
)
begin {
$services = Get-ViewAPIService -hvServer $hvServer
if ($null -eq $services) {
Write-Error "Could not retrieve ViewApi services from connection object"
break
}
}
process {
$globalSettings = $services.GlobalSettings.GlobalSettings_Get()
}
end {
Return $globalSettings
}
}
function Set-HVGlobalSettings {
<#
.SYNOPSIS
Sets the Global Settings of the Connection Server Pod
.DESCRIPTION
This cmdlet allows user to set Global Settings by passing key/value pair or by passing specific parameters. Optionally, user can pass a JSON spec file.
.PARAMETER Key
Property names path separated by . (dot) from the root of global settings spec.
.PARAMETER Value
Property value corresponds to above key name.
.PARAMETER HvServer
View API service object of Connect-HVServer cmdlet.
.PARAMETER Spec
Path of the JSON specification file containing key/value pair.
.PARAMETER clientMaxSessionTimePolicy
Client max session lifetime policy.
"TIMEOUT_AFTER" Indicates that the client session times out after a configurable session length (in minutes)
"NEVER" Indicates no absolute client session length (sessions only end due to inactivity)
.PARAMETER clientMaxSessionTimeMinutes
Determines how long a user can keep a session open after logging in to View Connection Server. The value is set in minutes. When a session times out, the session is terminated and the View client is disconnected from the resource.
Default value is 600.
Minimum value is 5.
Maximum value is 600.
This property is required if clientMaxSessionTimePolicy is set to "TIMEOUT_AFTER"
.PARAMETER clientIdleSessionTimeoutPolicy
Specifies the policy for the maximum time that a that a user can be idle before the broker takes measure to protect the session.
"TIMEOUT_AFTER" Indicates that the user session can be idle for a configurable max time (in minutes) before the broker takes measure to protect the session.
"NEVER" Indicates that the client session is never locked.
.PARAMETER clientIdleSessionTimeoutMinutes
Determines how long a that a user can be idle before the broker takes measure to protect the session. The value is set in minutes.
Default value is 15
This property is required if -clientIdleSessionTimeoutPolicy is set to "TIMEOUT_AFTER"
.PARAMETER clientSessionTimeoutMinutes
Determines the maximum length of time that a Broker session will be kept active if there is no traffic between a client and the Broker. The value is set in minutes.
Default value is 1200
Minimum value is 5
.PARAMETER desktopSSOTimeoutPolicy
The single sign on setting for when a user connects to View Connection Server.
"DISABLE_AFTER" SSO is disabled the specified number of minutes after a user connects to View Connection Server.
"DISABLED" Single sign on is always disabled.
"ALWAYS_ENABLED" Single sign on is always enabled.
.PARAMETER desktopSSOTimeoutMinutes
SSO is disabled the specified number of minutes after a user connects to View Connection Server.
Minimum value is 1
Maximum value is 999
.PARAMETER applicationSSOTimeoutPolicy
The single sign on timeout policy for application sessions.
"DISABLE_AFTER" SSO is disabled the specified number of minutes after a user connects to View Connection Server.
"DISABLED" Single sign on is always disabled.
"ALWAYS_ENABLED" Single sign on is always enabled.
.PARAMETER applicationSSOTimeoutMinutes
SSO is disabled the specified number of minutes after a user connects to View Connection Server.
Minimum value is 1
Maximum value is 999
.PARAMETER viewAPISessionTimeoutMinutes
Determines how long (in minutes) an idle View API session continues before the session times out. Setting the View API session timeout to a high number of minutes increases the risk of unauthorized use of View API. Use caution when you allow an idle session to persist a long time.
Default value is 10
Minimum value is 1
Maximum value is 4320
.PARAMETER preLoginMessage
Displays a disclaimer or another message to View Client users when they log in. No message will be displayed if this is null.
.PARAMETER displayWarningBeforeForcedLogoff
Displays a warning message when users are forced to log off because a scheduled or immediate update such as a machine-refresh operation is about to start.
$TRUE or $FALSE
.PARAMETER forcedLogoffMinutes
The number of minutes to wait after the warning is displayed and before logging off the user.
Default value is 5
Minimum value is 1
Maximum value is 999999
This property is required if displayWarningBeforeForcedLogoff is $true
.PARAMETER forcedLogoffMessage
The warning to be displayed before logging off the user.
.PARAMETER enableServerInSingleUserMode
Permits certain RDSServer operating systems to be used for non-RDS Desktops.
.PARAMETER storeCALOnBroker
Used for configuring whether or not to store the RDS Per Device CAL on Broker.
$TRUE or $FALSE
.PARAMETER storeCALOnClient
Used for configuring whether or not to store the RDS Per Device CAL on client devices. This value can be true only if the storeCALOnBroker is true.
$TRUE or $FALSE
.PARAMETER reauthSecureTunnelAfterInterruption
Reauthenticate secure tunnel connections after network interruption Determines if user credentials must be reauthenticated after a network interruption when View clients use secure tunnel connections to View resources. When you select this setting, if a secure tunnel connection ends during a session, View Client requires the user to reauthenticate before reconnecting. This setting offers increased security. For example, if a laptop is stolen and moved to a different network, the user cannot automatically gain access to the remote resource because the network connection was temporarily interrupted. When this setting is not selected, the client reconnects to the resource without requiring the user to reauthenticate. This setting has no effect when you use direct connection.
.PARAMETER messageSecurityMode
Determines if signing and verification of the JMS messages passed between View Manager components takes place.
"DISABLED" Message security mode is disabled.
"MIXED" Message security mode is enabled but not enforced. You can use this mode to detect components in your View environment that predate View Manager 3.0. The log files generated by View Connection Server contain references to these components.
"ENABLED" Message security mode is enabled. Unsigned messages are rejected by View components. Message security mode is enabled by default. Note: View components that predate View Manager 3.0 are not allowed to communicate with other View components.
"ENHANCED" Message Security mode is Enhanced. Message signing and validation is performed based on the current Security Level and desktop Message Security mode.
.PARAMETER enableIPSecForSecurityServerPairing
Determines whether to use Internet Protocol Security (IPSec) for connections between security servers and View Connection Server instances. By default, secure connections (using IPSec) for security server connections is enabled.
$TRUE or $FALSE
.EXAMPLE
Set-HVGlobalSettings 'ManualPool' -Spec 'C:\Set-HVGlobalSettings\Set-GlobalSettings.json'
.EXAMPLE
Set-HVGlobalSettings -Key 'generalData.clientMaxSessionTimePolicy' -Value 'NEVER'
.EXAMPLE
Set-HVGlobalSettings -clientMaxSessionTimePolicy "TIMEOUT_AFTER" -clientMaxSessionTimeMinutes 1200
.OUTPUTS
None
.NOTES
Author : Matt Frey.
Author email : mfrey@vmware.com
Version : 1.0
===Tested Against Environment====
Horizon View Server Version : 7.1
PowerCLI Version : PowerCLI 6.5.1
PowerShell Version : 5.0
#>
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = 'High'
)]
param(
[Parameter(Mandatory = $false)]
[string]$Key,
[Parameter(Mandatory = $false)]
$Value,
[Parameter(Mandatory = $false)]
[string]$Spec,
[Parameter(Mandatory = $false)]
[ValidateSet('TIMEOUT_AFTER','NEVER')]
[string]$clientMaxSessionTimePolicy,
[Parameter(Mandatory = $false)]
[ValidateRange(5,600)]
[Int]$clientMaxSessionTimeMinutes,
[Parameter(Mandatory = $false)]
[ValidateSet('TIMEOUT_AFTER','NEVER')]
[string]$clientIdleSessionTimeoutPolicy,
[Parameter(Mandatory = $false)]
[Int]$clientIdleSessionTimeoutMinutes,
[Parameter(Mandatory = $false)]
[Int]$clientSessionTimeoutMinutes,
[Parameter(Mandatory = $false)]
[ValidateSet('DISABLE_AFTER','DISABLED','ALWAYS_ENABLED')]
[string]$desktopSSOTimeoutPolicy,
[Parameter(Mandatory = $false)]
[ValidateRange(1,999)]
[Int]$desktopSSOTimeoutMinutes,
[Parameter(Mandatory = $false)]
[ValidateSet('DISABLE_AFTER','DISABLED','ALWAYS_ENABLED')]
[string]$applicationSSOTimeoutPolicy,
[Parameter(Mandatory = $false)]
[ValidateRange(1,999)]
[Int]$applicationSSOTimeoutMinutes,
[Parameter(Mandatory = $false)]
[ValidateRange(1,4320)]
[Int]$viewAPISessionTimeoutMinutes,
[Parameter(Mandatory = $false)]
[string]$preLoginMessage,
[Parameter(Mandatory = $false)]
[boolean]$displayWarningBeforeForcedLogoff,
[Parameter(Mandatory = $false)]
[ValidateRange(1,999999)]
[Int]$forcedLogoffTimeoutMinutes,
[Parameter(Mandatory = $false)]
[string]$forcedLogoffMessage,
[Parameter(Mandatory = $false)]
[boolean]$enableServerInSingleUserMode,
[Parameter(Mandatory = $false)]
[boolean]$storeCALOnBroker,
[Parameter(Mandatory = $false)]
[boolean]$storeCALOnClient,
[Parameter(Mandatory = $false)]
[boolean]$reauthSecureTunnelAfterInterruption,
[Parameter(Mandatory = $false)]
[ValidateSet('DISABLED','MIXED','ENABLED','ENHANCED')]
[string]$messageSecurityMode,
[Parameter(Mandatory = $false)]
[boolean]$enableIPSecForSecurityServerPairing,
[Parameter(Mandatory = $false)]
$HvServer = $null
)
begin {
$services = Get-ViewAPIService -hvServer $hvServer
if ($null -eq $services) {
Write-Error "Could not retrieve ViewApi services from connection object"
break
}
}
process {
$updates = @()
if ($key -and $value) {
$updates += Get-MapEntry -key $key -value $value
} elseif ($key -or $value) {
Write-Error "Both key:[$key] and value:[$value] needs to be specified"
}
if ($spec) {
try {
$specObject = Get-JsonObject -specFile $spec
} catch {
Write-Error "Json file exception, $_"
return
}
foreach ($member in ($specObject.PSObject.Members | Where-Object { $_.MemberType -eq 'NoteProperty' })) {
$updates += Get-MapEntry -key $member.name -value $member.value
}
}
if ($clientMaxSessionTimePolicy) {
$updates += Get-MapEntry -key 'generalData.clientMaxSessionTimePolicy' -Value $clientMaxSessionTimePolicy
}
if ($clientMaxSessionTimeMinutes) {
$updates += Get-MapEntry -key 'generalData.clientMaxSessionTimeMinutes' -Value $clientMaxSessionTimeMinutes
}
if ($clientIdleSessionTimeoutPolicy) {
$updates += Get-MapEntry -key 'generalData.clientIdleSessionTimeoutPolicy' -Value $clientIdleSessionTimeoutPolicy
}
if ($clientIdleSessionTimeoutMinutes) {
$updates += Get-MapEntry -key 'generalData.clientIdleSessionTimeoutMinutes' -Value $clientIdleSessionTimeoutMinutes
}
if ($clientSessionTimeoutMinutes) {
$updates += Get-MapEntry -key 'generalData.clientSessionTimeoutMinutes' -Value $clientSessionTimeoutMinutes
}
if ($desktopSSOTimeoutPolicy) {
$updates += Get-MapEntry -key 'generalData.desktopSSOTimeoutPolicy' -Value $desktopSSOTimeoutPolicy
}
if ($desktopSSOTimeoutMinutes) {
$updates += Get-MapEntry -key 'generalData.desktopSSOTimeoutMinutes' -Value $desktopSSOTimeoutMinutes
}
if ($applicationSSOTimeoutPolicy) {
$updates += Get-MapEntry -key 'generalData.applicationSSOTimeoutPolicy' -Value $applicationSSOTimeoutPolicy
}
if ($applicationSSOTimeoutMinutes) {
$updates += Get-MapEntry -key 'generalData.applicationSSOTimeoutMinutes' -Value $applicationSSOTimeoutMinutes
}
if ($viewAPISessionTimeoutMinutes) {
$updates += Get-MapEntry -key 'generalData.viewAPISessionTimeoutMinutes' -Value $viewAPISessionTimeoutMinutes
}
if ($preLoginMessage) {
$updates += Get-MapEntry -key 'generalData.preLoginMessage' -Value $preLoginMessage
}
if ($displayWarningBeforeForcedLogoff) {
$updates += Get-MapEntry -key 'generalData.displayWarningBeforeForcedLogoff' -Value $displayWarningBeforeForcedLogoff
}
if ($forcedLogoffTimeoutMinutes) {
$updates += Get-MapEntry -key 'generalData.forcedLogoffTimeoutMinutes' -Value $forcedLogoffTimeoutMinutes
}
if ($forcedLogoffMessage) {
$updates += Get-MapEntry -key 'generalData.forcedLogoffMessage' -Value $forcedLogoffMessage
}
if ($enableServerInSingleUserMode) {
$updates += Get-MapEntry -key 'generalData.enableServerInSingleUserMode' -Value $enableServerInSingleUserMode
}
if ($storeCALOnBroker) {
$updates += Get-MapEntry -key 'generalData.storeCALOnBroker' -Value $storeCALOnBroker
}
if ($storeCALOnClient) {
$updates += Get-MapEntry -key 'generalData.storeCALOnClient' -Value $storeCALOnClient
}
if ($reauthSecureTunnelAfterInterruption) {
$updates += Get-MapEntry -key 'securityData.reauthSecureTunnelAfterInterruption' -Value $reauthSecureTunnelAfterInterruption
}
if ($messageSecurityMode) {
$updates += Get-MapEntry -key 'securityData.messageSecurityMode' -Value $messageSecurityMode
}
if ($enableIPSecForSecurityServerPairing) {
$updates += Get-MapEntry -key 'securityData.enableIPSecForSecurityServerPairing' -Value $enableIPSecForSecurityServerPairing
}
$global_settings_helper = New-Object VMware.Hv.GlobalSettingsService
$global_settings_helper.GlobalSettings_Update($services,$updates)
}
end {
[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, Get-HVPodSession, Set-HVApplicationIcon, Remove-HVApplicationIcon, Get-HVGlobalSettings, Set-HVGlobalSettings