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
Exit-PSSession[/pre]
Prompt is [SERVER]: PS current location>
As a normal user or admin using following code fails as previous mentioned:
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’.