Dado:
O arquivo compartilhado está acessível em bob:
PS D:\temp> echo $env:COMPUTERNAME
bob
PS D:\temp> dir \alice\users\mkharitonov.txt
Directory: \alice\users\mkharitonov
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 3/20/2018 12:46 PM 558 1.txt
PS D:\temp> echo $env:USERNAME
mkharitonov
PS D:\temp> echo $env:USERDOMAIN
xyz
PS D:\temp>
Mas não se eu estou tentando fazer isso de uma sessão remota do Powershell aberta para bob de alice:
PS E:\utils> echo $env:COMPUTERNAME
alice
PS E:\utils> Enter-PSSession -ComputerName bob
[bob]: PS C:\Users\mkharitonov\Documents> Test-WsMan alice
wsmid : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor : Microsoft Corporation
ProductVersion : OS: 0.0.0 SP: 0.0 Stack: 3.0
[bob]: PS C:\Users\mkharitonov\Documents> dir \alice\users\mkharitonov.txt
dir : Access is denied
+ CategoryInfo : PermissionDenied: (\alice\users\mkharitonov.txt:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
dir : Cannot find path '\alice\users\mkharitonov.txt' because it does not exist.
+ CategoryInfo : ObjectNotFound: (\alice\users\mkharitonov.txt:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
[bob]: PS C:\Users\mkharitonov\Documents> dir \alice.xyz.com\users\mkharitonov.txt
dir : Access is denied
+ CategoryInfo : PermissionDenied: (\alice.xyz...tonov.txt:String) [Get-ChildItem], UnauthorizedAccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetChildItemCommand
dir : Cannot find path '\alice.xyz.com\users\mkharitonov.txt' because it does not exist.
+ CategoryInfo : ObjectNotFound: (\alice.dayf...tonov.txt:String) [Get-ChildItem], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
[bob]: PS C:\Users\mkharitonov\Documents> echo $env:USERNAME
mkharitonov
[bob]: PS C:\Users\mkharitonov\Documents> echo $env:USERDOMAIN
xyz
[bob]: PS C:\Users\mkharitonov\Documents>
Agora alice é acessível a partir de bob:
[bob]: PS C:\Users\mkharitonov\Documents> ping alice
Pinging alice.xyz.com [192.168.21.61] with 32 bytes of data:
Reply from 192.168.21.61: bytes=32 time=32ms TTL=125
Reply from 192.168.21.61: bytes=32 time=33ms TTL=125
Reply from 192.168.21.61: bytes=32 time=32ms TTL=125
Reply from 192.168.21.61: bytes=32 time=32ms TTL=125
Ping statistics for 192.168.21.61:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 32ms, Maximum = 33ms, Average = 32ms
[bob]: PS C:\Users\mkharitonov\Documents> ping alice.xyz.com
Pinging alice.xyz.com [192.168.21.61] with 32 bytes of data:
Reply from 192.168.21.61: bytes=32 time=32ms TTL=125
Reply from 192.168.21.61: bytes=32 time=32ms TTL=125
Reply from 192.168.21.61: bytes=32 time=33ms TTL=125
Reply from 192.168.21.61: bytes=32 time=33ms TTL=125
Ping statistics for 192.168.21.61:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 32ms, Maximum = 33ms, Average = 32ms
[bob]: PS C:\Users\mkharitonov\Documents>
Qual é o problema? Por que não consigo visualizar o diretório da sessão remota para bob, mas posso vê-lo bem quando conectado ao bob por RDP?