Get-QlikSession.ps1
function Get-QlikSession { <# .SYNOPSIS This function ... .DESCRIPTION A bit more description .PARAMETER FromPipeline Shows how to process input from the pipeline, remaining parameters or by named parameter. .EXAMPLE Get-QlikSession 'abc' Description of the example. #> <# Enable -Confirm and -WhatIf. #> [CmdletBinding(SupportsShouldProcess = $true, DefaultParameterSetName="User")] param( [parameter(ParameterSetName="Id",Mandatory=$true,Position=0,ValueFromPipelinebyPropertyName=$true)] [string]$id, [parameter(ParameterSetName="User",Mandatory=$true,Position=0,ValueFromPipelinebyPropertyName=$true)] [string]$userDirectory, [parameter(ParameterSetName="User",Mandatory=$true,Position=1,ValueFromPipelinebyPropertyName=$true)] [string]$userId, [alias("vp")] [string]$virtualProxyPrefix, [switch]$raw ) begin { } process { $proxy = Get-QlikProxy local $prefix = "https://$($proxy.serverNodeConfiguration.hostName):$($proxy.settings.restListenPort)/qps" if ($virtualProxyPrefix) { $prefix += "/$virtualProxyPrefix" } if ($id) { $path = "$prefix/session/$id" } else { $path = "$prefix/user/$userDirectory/$userId" } If( $raw ) { $rawOutput = $true } return Invoke-QlikGet $path } end { } } if ($loadingModule) { Export-ModuleMember -Function 'Get-QlikSession' } |