Author Posts

October 31, 2017 at 10:12 pm

I am unable to use the set-location command after I have connected to remote computer using enter-pssession. Is this possible?

Thank for any help!

Robert

October 31, 2017 at 11:11 pm

Provided the location you specify exists and you have permission, and the Remoting endpoint doesn't prevent it, then yes.

November 1, 2017 at 12:50 pm

What happens if you:
PS> Enter-PSSession $Hostname
PS> Test-Path $ThePathYouWantToSet-LocationTo

November 1, 2017 at 4:09 pm

Thank you.... Don

The location does exist.

This is a domain computer. I can use the set-location command when I am physically on the machine:

PS C:\WINDOWS\system32> hostname
OWT2077

PS C:\WINDOWS\system32> Set-Location -Path \\owsms\Infotech

PS Microsoft.PowerShell.Core\FileSystem::\\owsms\Infotech>

When connect to OWT2077 using enable-pssession and try using the set-location command I get this:

[owt2077]: PS C:\Users\e139022\Documents> Set-Location "\\owsms\infotech"

Set-Location : Access is denied
+ CategoryInfo : PermissionDenied: (\\owsms\infotech:String) [Set-Location], UnauthorizedAcc
essException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.SetLocation
Command

I don't understand where the PermissionDenied is coming from?

Thank you again for your input!

Robert

November 1, 2017 at 4:20 pm

Ah. You're attempting to connect to a UNC. That won't work in the default Remoting world because your delegated credential cannot be delegated across a second hop. This is “the second hop problem;” see same in “Secrets of PowerShell Remoting” on our ebooks menu. You would be perhaps better cresting a new PSDrive to the UNC, as you can provide explicit credentials to do so.

November 1, 2017 at 4:42 pm

Thank you Don!

I have to say – I didn't expect to get a response from someone with your level of skill and recognition. I am pretty new to PowerShell but I have completely absorbed myself in it. I have taken your "Play by Play: PowerShell from Idea to Action" on Pluralsight. I also have listened to you on Channel 9. I have taken the courses on MVA taught by Jason Helmick and Jeffery Snover. Jeffery Snover is always touting how great the PowerShell community is. After this experience – I am can see why. You guys are all great teachers and I enjoy learning from all of you. So Thank You for sacrifices and time you give.

Robert Rosas

November 1, 2017 at 8:13 pm

Don ... that guy 😉