Constrained Endpoints + C-drive


I have a constrained endpoint via New-PSSessionConfigurationFile. With it I have enabled Get-Location and Set-Location as VisibleCmdlets.

Via the endpoint I want to go to a directory to run the program inside it. But it fails with the error “Cannot find a provider with the name ‘FileSystem’.”

As admin I use following code and it works:

[pre]Enter-PSSession -ComputerName SERVER
Set-Location -Path C:…
…exe -parameter

Prompt is [SERVER]: PS current location>

As a normal user or admin using following code fails as previous mentioned:

[pre]Enter-PSSession -ComputerName SERVER -ConfigurationName SOMETHING
Set-Location -Path C:…
…exe -parameter

Prompt is [SERVER]: PS> --> this is much shorter than the normal endpoint.

How can I fix the Set-Location by adding the provider ‘FileSystem’ to my constrained endpoint?


Edit you JEA session Role Capabilities .psrc file, and update/uncomment the ‘VisibleProviders’ line as in:

# Providers to make visible when applied to a session
VisibleProviders = 'FileSystem'

Thanks, that part works now.

The code is part of a function inside a module of my own. When I execute the function now it stops with an error:

[pre]Set-Location -Path “C:\Program Files\PROGRAM”
.\util.exe -c C:\Script\FILE.xml[/pre]

Error: “Set-Location : Cannot find path ‘C:\Program Files\PROGRAM’ because it does not exist.”

When I execute the code outside the function the location is set and it stops with another error: “The term ‘.\util.exe’ is not recognized as the name of a cmdlet, function, script file, or operable program.”

Outside the constrained endpoint it works. With my pssc-file I have added "VisibleExternalCommands ‘C:\Program Files\PROGRAM\util.exe’.

Again, what do I miss?