Trying to pass down variables per session to endpoints, just for simple use across endpoints.
Relevant code:
$Session:FolderContentsPath = 'C:\temp'
$Session:FolderContentsTableId = 'FolderContentsTable'
New-UDEndpointInitialization -Variable 'FolderContentsPath','FolderContentsTableId'
New-UDCard -Id 'FolderContentsCard' -Title "Contents of" -Endpoint {
New-UDInput -Title 'Path:' -Endpoint {
param($Path)
$Session:FolderContentsPath = $Path
Sync-UDElement -Id $Session:FolderContentsTableId
}
New-UDTable -Id $Session:FolderContentsTableId -Headers "Mode","LastWriteTime","Length","Name" -Endpoint {
Get-ChildItem $Session:FolderContentsPath | Out-UDTableData -Property "Mode","LastWriteTime","Length","Name"
}
}
Gives the error:
New-UDDashboard : Exception calling "Invoke" with "0" argument(s): "Content writer cannot be retrieved for the 'Session' provider for the path 'FolderContentsPath'. Object reference not
set to an instance of an object."
Only relevant line from UD log is:
09:37:35 [Debug] SessionDriveVariableProvider GetContentWriter - FolderContentsPath, then the log ends.
PSVersion:
Name Value
---- -----
PSVersion 5.1.18362.145
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.18362.145
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
What do I need to change to get session variables working?