Public/HostPool.ps1
Function Remove-NmeHostPool { <# .SYNOPSIS Delete ARM host pool. .DESCRIPTION Delete ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName} endpoint of the NME REST API, using the delete method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName$Querystring" -Method delete -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPool { <# .SYNOPSIS Get ARM host pool. .DESCRIPTION Get ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName} endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeArmHostpool') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeHostPool { <# .SYNOPSIS Create static host pool. .DESCRIPTION ## Notes - Either *pooledParams* or *personalParams* property must be specified - *isDesktop = true* will create pool with Desktop Application Group - *isDesktop = false* will create pool with RemoteApp Application Group - *isSingleUser = true* will set session limit to 1 per each host in pool - *isSingleUser = false* will set session limit to 999999 per each host in pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName} endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeCreateArmHostPoolRequest Requires an NmeCreateArmHostPoolRequest object, as generated by the New-NmeCreateArmHostPoolRequest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeCreateArmHostPoolRequest"){$true} else{throw " is not a NmeCreateArmHostPoolRequest object."}})]$NmeCreateArmHostPoolRequest ) Set-NmeAuthHeaders Try { $json = $NmeCreateArmHostPoolRequest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolAutoScaleConfig { <# .SYNOPSIS Get autoscale config for ARM host pool. .DESCRIPTION Get autoscale config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/auto-scale endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/auto-scale$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeDynamicPoolConfiguration') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Update-NmeHostPoolAutoScaleConfig { <# .SYNOPSIS Enable/disable autoscale for ARM host pool. .DESCRIPTION Enable/disable autoscale for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/auto-scale endpoint of the NME REST API, using the patch method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeUpdateAutoScaleRequest Requires an NmeUpdateAutoScaleRequest object, as generated by the New-NmeUpdateAutoScaleRequest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeUpdateAutoScaleRequest"){$true} else{throw " is not a NmeUpdateAutoScaleRequest object."}})]$NmeUpdateAutoScaleRequest ) Set-NmeAuthHeaders Try { $json = $NmeUpdateAutoScaleRequest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/auto-scale$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function ConvertTo-NmeDynamicHostPool { <# .SYNOPSIS Convert static ARM host pool to dynamic. .DESCRIPTION Convert static ARM host pool to dynamic. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/auto-scale endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/auto-scale$Querystring" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolAutoScaleConfig { <# .SYNOPSIS Update autoscale config for ARM host pool. .DESCRIPTION Update autoscale config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/auto-scale endpoint of the NME REST API, using the put method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER MultiTriggers Enable to use multiple Autoscale triggers .PARAMETER AutoHealActions Enables AutoHeal actions for host pool .PARAMETER NmeDynamicPoolConfiguration Requires an NmeDynamicPoolConfiguration object, as generated by the New-NmeDynamicPoolConfiguration command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(ValueFromPipelineByPropertyName=$true)][boolean]$MultiTriggers, [Parameter(ValueFromPipelineByPropertyName=$true)][boolean]$AutoHealActions, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeDynamicPoolConfiguration"){$true} else{throw " is not a NmeDynamicPoolConfiguration object."}})]$NmeDynamicPoolConfiguration ) Set-NmeAuthHeaders Try { $QueryString = '?' $QueryStrings = @{} $QueryStrings += @{multiTriggers= $multiTriggers} $QueryStrings += @{autoHealActions= $autoHealActions} $QueryString += ($QueryStrings.GetEnumerator() | % { "$($_.Key)=$($_.Value)" }) -join '&' $json = $NmeDynamicPoolConfiguration | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/auto-scale$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolScheduledReimageJob { <# .SYNOPSIS Get scheduled re-image job params for ARM host pool. .DESCRIPTION Get scheduled re-image job params for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/schedule/reimage/job-params endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/schedule/reimage/job-params$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeReimageScheduledBulkJobParams') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolScheduledScriptConfig { <# .SYNOPSIS Get scheduled script execution job params for ARM host pool. .DESCRIPTION Get scheduled script execution job params for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/schedule/script-execution/job-params endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/schedule/script-execution/job-params$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeRunScriptScheduledBulkJobParams') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolADConfig { <# .SYNOPSIS Get Active Directory configuration for ARM host pool. .DESCRIPTION Get Active Directory configuration for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/active-directory endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/active-directory$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolActiveDirectoryRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolADConfig { <# .SYNOPSIS Update Active Directory configuration for ARM host pool. .DESCRIPTION Update Active Directory configuration for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/active-directory endpoint of the NME REST API, using the put method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeUpdateHostPoolActiveDirectoryRestModel Requires an NmeUpdateHostPoolActiveDirectoryRestModel object, as generated by the New-NmeUpdateHostPoolActiveDirectoryRestModel command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeUpdateHostPoolActiveDirectoryRestModel"){$true} else{throw " is not a NmeUpdateHostPoolActiveDirectoryRestModel object."}})]$NmeUpdateHostPoolActiveDirectoryRestModel ) Set-NmeAuthHeaders Try { $json = $NmeUpdateHostPoolActiveDirectoryRestModel | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/active-directory$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolActiveDirectoryRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolFslConfig { <# .SYNOPSIS Get FSLogix config for ARM host pool. .DESCRIPTION Get FSLogix config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/fslogix endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/fslogix$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolFsLogixRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolFslConfig { <# .SYNOPSIS Update FSLogix config for ARM host pool. .DESCRIPTION Update FSLogix config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/fslogix endpoint of the NME REST API, using the put method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeUpdateHostPoolFsLogixRestModel Requires an NmeUpdateHostPoolFsLogixRestModel object, as generated by the New-NmeUpdateHostPoolFsLogixRestModel command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeUpdateHostPoolFsLogixRestModel"){$true} else{throw " is not a NmeUpdateHostPoolFsLogixRestModel object."}})]$NmeUpdateHostPoolFsLogixRestModel ) Set-NmeAuthHeaders Try { $json = $NmeUpdateHostPoolFsLogixRestModel | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/fslogix$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolFsLogixRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolAVDConfig { <# .SYNOPSIS Get AVD properties for ARM host pool. .DESCRIPTION Get AVD properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/wvd endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/wvd$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeArmHostPoolPropertiesRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolAVDConfig { <# .SYNOPSIS Update AVD properties for ARM host pool. .DESCRIPTION Update AVD properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/wvd endpoint of the NME REST API, using the patch method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeArmHostPoolPropertiesRestModel Requires an NmeArmHostPoolPropertiesRestModel object, as generated by the New-NmeArmHostPoolPropertiesRestModel command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeArmHostPoolPropertiesRestModel"){$true} else{throw " is not a NmeArmHostPoolPropertiesRestModel object."}})]$NmeArmHostPoolPropertiesRestModel ) Set-NmeAuthHeaders Try { $json = $NmeArmHostPoolPropertiesRestModel | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/wvd$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeArmHostPoolPropertiesRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeVmDeploymentConfig { <# .SYNOPSIS Get host deployment config for ARM host pool. .DESCRIPTION Get host deployment config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/vm-deployment endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/vm-deployment$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolVmDeploymentRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Update-NmeVmDeploymentConfig { <# .SYNOPSIS Patch host deployment config for ARM host pool. .DESCRIPTION Patch host deployment config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/vm-deployment endpoint of the NME REST API, using the patch method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeHostPoolVmDeploymentRestModel Requires an NmeHostPoolVmDeploymentRestModel object, as generated by the New-NmeHostPoolVmDeploymentRestModel command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeHostPoolVmDeploymentRestModel"){$true} else{throw " is not a NmeHostPoolVmDeploymentRestModel object."}})]$NmeHostPoolVmDeploymentRestModel ) Set-NmeAuthHeaders Try { $json = $NmeHostPoolVmDeploymentRestModel | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/vm-deployment$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolVmDeploymentRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeVmDeploymentConfig { <# .SYNOPSIS Update host deployment config for ARM host pool. .DESCRIPTION Update host deployment config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/vm-deployment endpoint of the NME REST API, using the put method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeHostPoolVmDeploymentRestPutRequest Requires an NmeHostPoolVmDeploymentRestPutRequest object, as generated by the New-NmeHostPoolVmDeploymentRestPutRequest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeHostPoolVmDeploymentRestPutRequest"){$true} else{throw " is not a NmeHostPoolVmDeploymentRestPutRequest object."}})]$NmeHostPoolVmDeploymentRestPutRequest ) Set-NmeAuthHeaders Try { $json = $NmeHostPoolVmDeploymentRestPutRequest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/vm-deployment$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolVmDeploymentRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolSessionTimeoutConfig { <# .SYNOPSIS Get session timeout config for ARM host pool. .DESCRIPTION Get session timeout config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/session-timeout endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/session-timeout$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolSessionTimeoutRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolSessionTimeoutConfig { <# .SYNOPSIS Update session timeout config for ARM host pool. .DESCRIPTION Update session timeout config for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/session-timeout endpoint of the NME REST API, using the put method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeHostPoolSessionTimeoutRestModel Requires an NmeHostPoolSessionTimeoutRestModel object, as generated by the New-NmeHostPoolSessionTimeoutRestModel command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeHostPoolSessionTimeoutRestModel"){$true} else{throw " is not a NmeHostPoolSessionTimeoutRestModel object."}})]$NmeHostPoolSessionTimeoutRestModel ) Set-NmeAuthHeaders Try { $json = $NmeHostPoolSessionTimeoutRestModel | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/session-timeout$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolSessionTimeoutRestModel') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolScheduledTasks { <# .SYNOPSIS Get scheduled tasks for ARM host pool. .DESCRIPTION Get scheduled tasks for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/schedule endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/schedule$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostpoolScheduleRestModel') $Result | ForEach-Object {$_ | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue'} $Result | ForEach-Object {$_ | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue'} $Result | ForEach-Object {$_ | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue'} $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolCustomTags { <# .SYNOPSIS Get custom tags for ARM host pool. .DESCRIPTION Get custom tags for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/tag endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/tag$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolTagsRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolCustomTags { <# .SYNOPSIS Update custom tags for ARM host pool. .DESCRIPTION Update custom tags for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/tag endpoint of the NME REST API, using the put method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeUpdateHostPoolTagsRest Requires an NmeUpdateHostPoolTagsRest object, as generated by the New-NmeUpdateHostPoolTagsRest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeUpdateHostPoolTagsRest"){$true} else{throw " is not a NmeUpdateHostPoolTagsRest object."}})]$NmeUpdateHostPoolTagsRest ) Set-NmeAuthHeaders Try { $json = $NmeUpdateHostPoolTagsRest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/tag$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeUpdateHostPoolTagsResultRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolRdpConfig { <# .SYNOPSIS Get RDP properties for ARM host pool. .DESCRIPTION Get RDP properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/rdp endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/rdp$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolRdpModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolRdpConfig { <# .SYNOPSIS Update RDP properties for ARM host pool. .DESCRIPTION Update RDP properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/rdp endpoint of the NME REST API, using the put method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeHostPoolRdpModelRest Requires an NmeHostPoolRdpModelRest object, as generated by the New-NmeHostPoolRdpModelRest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeHostPoolRdpModelRest"){$true} else{throw " is not a NmeHostPoolRdpModelRest object."}})]$NmeHostPoolRdpModelRest ) Set-NmeAuthHeaders Try { $json = $NmeHostPoolRdpModelRest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/rdp$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolRdpModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolUsageTracking { <# .SYNOPSIS Get usage tracking properties for ARM host pool. .DESCRIPTION Get usage tracking properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/tracking endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/tracking$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolTrackingModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolUsageTracking { <# .SYNOPSIS Update usage tracking properties for ARM host pool. .DESCRIPTION Update usage tracking properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/tracking endpoint of the NME REST API, using the patch method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeHostPoolTrackingModelRest Requires an NmeHostPoolTrackingModelRest object, as generated by the New-NmeHostPoolTrackingModelRest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeHostPoolTrackingModelRest"){$true} else{throw " is not a NmeHostPoolTrackingModelRest object."}})]$NmeHostPoolTrackingModelRest ) Set-NmeAuthHeaders Try { $json = $NmeHostPoolTrackingModelRest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/tracking$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolTrackingModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolBackupConfig { <# .SYNOPSIS Get backup properties for ARM host pool. .DESCRIPTION Get backup properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/backup endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/backup$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolBackupModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolBackupConfig { <# .SYNOPSIS Update backup properties for ARM host pool. .DESCRIPTION Update backup properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/backup endpoint of the NME REST API, using the patch method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeHostPoolBackupModelRest Requires an NmeHostPoolBackupModelRest object, as generated by the New-NmeHostPoolBackupModelRest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeHostPoolBackupModelRest"){$true} else{throw " is not a NmeHostPoolBackupModelRest object."}})]$NmeHostPoolBackupModelRest ) Set-NmeAuthHeaders Try { $json = $NmeHostPoolBackupModelRest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/backup$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolBackupModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmeHostPoolSelfServiceConfig { <# .SYNOPSIS Get user self-service properties for ARM host pool. .DESCRIPTION Get user self-service properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/user-self-service endpoint of the NME REST API, using the get method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/user-self-service$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolUserSelfServiceModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmeHostPoolSelfServiceConfig { <# .SYNOPSIS Update user self-service properties for ARM host pool. .DESCRIPTION Update user self-service properties for ARM host pool. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/user-self-service endpoint of the NME REST API, using the patch method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeHostPoolUserSelfServiceModelRest Requires an NmeHostPoolUserSelfServiceModelRest object, as generated by the New-NmeHostPoolUserSelfServiceModelRest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeHostPoolUserSelfServiceModelRest"){$true} else{throw " is not a NmeHostPoolUserSelfServiceModelRest object."}})]$NmeHostPoolUserSelfServiceModelRest ) Set-NmeAuthHeaders Try { $json = $NmeHostPoolUserSelfServiceModelRest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/user-self-service$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeHostPoolUserSelfServiceModelRest') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeHostPoolReimageTask { <# .SYNOPSIS Re-image ARM host pool session hosts' VMs. .DESCRIPTION Re-image ARM host pool session hosts' VMs. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/reimage endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeReimagePoolRequest Requires an NmeReimagePoolRequest object, as generated by the New-NmeReimagePoolRequest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeReimagePoolRequest"){$true} else{throw " is not a NmeReimagePoolRequest object."}})]$NmeReimagePoolRequest ) Set-NmeAuthHeaders Try { $json = $NmeReimagePoolRequest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/reimage$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeHostPoolScheduleReimageTask { <# .SYNOPSIS Schedule re-image ARM host pool session hosts' VMs. .DESCRIPTION Schedule re-image ARM host pool session hosts' VMs. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/schedule/reimage endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeScheduleReimagePoolRestPayload Requires an NmeScheduleReimagePoolRestPayload object, as generated by the New-NmeScheduleReimagePoolRestPayload command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeScheduleReimagePoolRestPayload"){$true} else{throw " is not a NmeScheduleReimagePoolRestPayload object."}})]$NmeScheduleReimagePoolRestPayload ) Set-NmeAuthHeaders Try { $json = $NmeScheduleReimagePoolRestPayload | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/schedule/reimage$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeReimageScheduledBulkJobParams') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeHostPoolScriptTask { <# .SYNOPSIS Run script on ARM host pool session hosts' VMs. .DESCRIPTION Run script on ARM host pool session hosts' VMs. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/script-execution endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeRunHostPoolScriptRestRequest Requires an NmeRunHostPoolScriptRestRequest object, as generated by the New-NmeRunHostPoolScriptRestRequest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeRunHostPoolScriptRestRequest"){$true} else{throw " is not a NmeRunHostPoolScriptRestRequest object."}})]$NmeRunHostPoolScriptRestRequest ) Set-NmeAuthHeaders Try { $json = $NmeRunHostPoolScriptRestRequest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/script-execution$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeHostPoolScriptedActionSchedule { <# .SYNOPSIS Schedule script execution on ARM host pool session hosts' VMs. .DESCRIPTION Schedule script execution on ARM host pool session hosts' VMs. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/schedule/script-execution endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeScheduleHostPoolScriptRestPayload Requires an NmeScheduleHostPoolScriptRestPayload object, as generated by the New-NmeScheduleHostPoolScriptRestPayload command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeScheduleHostPoolScriptRestPayload"){$true} else{throw " is not a NmeScheduleHostPoolScriptRestPayload object."}})]$NmeScheduleHostPoolScriptRestPayload ) Set-NmeAuthHeaders Try { $json = $NmeScheduleHostPoolScriptRestPayload | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/schedule/script-execution$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeRunScriptScheduledBulkJobParams') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeHostPoolUserAssignment { <# .SYNOPSIS Assign users and/or groups to ARM host pool. .DESCRIPTION ## Notes - **Users** can be either an array of principals or GUIDs - **Groups** can be an array of GUID only. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/assign endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeArmHostPoolAssignmentRequest Requires an NmeArmHostPoolAssignmentRequest object, as generated by the New-NmeArmHostPoolAssignmentRequest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeArmHostPoolAssignmentRequest"){$true} else{throw " is not a NmeArmHostPoolAssignmentRequest object."}})]$NmeArmHostPoolAssignmentRequest ) Set-NmeAuthHeaders Try { $json = $NmeArmHostPoolAssignmentRequest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/assign$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmeHostPoolUserUnassignment { <# .SYNOPSIS Unassign users and/or groups from ARM host pool. .DESCRIPTION ## Notes - **Users** can be either an array of principals or GUIDs - **Groups** can be an array of GUID only. This function calls the /api/v1/arm/hostpool/{subscriptionId}/{resourceGroup}/{hostPoolName}/unassign endpoint of the NME REST API, using the post method. .PARAMETER SubscriptionId The id (guid) of the subscription where this hostpool resides .PARAMETER ResourceGroup The Azure resource group where the hostpool resides .PARAMETER HostPoolName The name of the Host Pool .PARAMETER NmeArmHostPoolAssignmentRequest Requires an NmeArmHostPoolAssignmentRequest object, as generated by the New-NmeArmHostPoolAssignmentRequest command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$SubscriptionId, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$ResourceGroup, [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][string]$HostPoolName, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeArmHostPoolAssignmentRequest"){$true} else{throw " is not a NmeArmHostPoolAssignmentRequest object."}})]$NmeArmHostPoolAssignmentRequest ) Set-NmeAuthHeaders Try { $json = $NmeArmHostPoolAssignmentRequest | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/arm/hostpool/$SubscriptionId/$ResourceGroup/$HostPoolName/unassign$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'subscriptionId' -NotePropertyValue $subscriptionId -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'resourceGroup' -NotePropertyValue $resourceGroup -erroraction 'SilentlyContinue' $Result | Add-Member -NotePropertyName 'hostPoolName' -NotePropertyValue $hostPoolName -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } |