Constrained Endpoints + C-drive

Welcome Forums General PowerShell Q&A Constrained Endpoints + C-drive

Viewing 2 reply threads
  • Author
    Posts
    • #230896
      Participant
      Topics: 5
      Replies: 7
      Points: 47
      Rank: Member

      Hi

      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?

      Greetings

      • This topic was modified 1 month, 3 weeks ago by wim54.
    • #230908
      Participant
      Topics: 12
      Replies: 525
      Points: 1,233
      Helping Hand
      Rank: 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'
      
    • #230938
      Participant
      Topics: 5
      Replies: 7
      Points: 47
      Rank: 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?

Viewing 2 reply threads
  • You must be logged in to reply to this topic.