I often use PowerShell remote sessions to manage windows servers remotely, generally using the following command, though the following is true for any remote powershell commands such as Invoke-Command
:
Enter-PSSession Server01
This works perfectly for almost everything local to that server, but never allows you to reach outside, e.g.:
PS C:\> Enter-PSSession Server01
[Server01]: PS C:\> Get-Item '\\Server02\Share\File'
get-item : Access is denied
What is the easiest, secure way to do a second-hop like this? I have a couple answers I'll add, but they generally have caveats.