set-location and enter-pssession

This topic contains 6 replies, has 3 voices, and was last updated by  tmack8080 2 weeks, 4 days ago.

  • Author
    Posts
  • #83308

    RobertRosas
    Participant

    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

  • #83309

    Don Jones
    Keymaster

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

    • #83351

      tmack8080
      Participant

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

  • #83402

    RobertRosas
    Participant

    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

  • #83414

    Don Jones
    Keymaster

    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.

  • #83423

    RobertRosas
    Participant

    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

  • #83435

    tmack8080
    Participant

    Don ... that guy 😉

You must be logged in to reply to this topic.