May 26, 2020 at 10:11 am #230896ParticipantTopics: 5Replies: 7Points: 47Rank: Member
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:
Enter-PSSession -ComputerName SERVER Set-Location -Path C:\… ….exe -parameter Exit-PSSession
Prompt is [SERVER]: PS current location>
As a normal user or admin using following code fails as previous mentioned:
Enter-PSSession -ComputerName SERVER -ConfigurationName SOMETHING Set-Location -Path C:\… ….exe -parameter Exit-PSSession
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?
- This topic was modified 1 month, 3 weeks ago by wim54.
May 26, 2020 at 10:26 am #230908ParticipantTopics: 12Replies: 525Points: 1,233Rank: Community Hero
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'
May 26, 2020 at 12:04 pm #230938ParticipantTopics: 5Replies: 7Points: 47Rank: Member
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:
Set-Location -Path “C:\Program Files\PROGRAM\” .\util.exe -c C:\Script\FILE.xml
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?
- You must be logged in to reply to this topic.