20,212 questions
Cannot access SMB server in PowerShell inmmediately after successful access to it

Vita
76
Reputation points
It's explained better viewing the console:
[ COMMENTS PRECEDED WITH DOUBLE # ]
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
## \\zx0\intranet mounts in drive B: via Group Policy
## \\zx0\home mounts in drive A: via Group Policy
## (This a Windows Server 2019 no desktop machine. Only PowerShell, even via RDP)
## Accessing this server using Enter-PSSession does not have the mounts A: and B: but they
## can be mounted using New-SmbMapping. Accessing this via RDP doesn't allow mounting them
## They can be accessed simply with Set-Location but just once.
PS C:\Windows\system32> B:
Set-Location : Cannot find drive. A drive with the name 'B' does not exist.
At line:1 char:1
+ Set-Location $MyInvocation.MyCommand.Name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (B:String) [Set-Location], DriveNotFoundException
+ FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS C:\Windows\system32> New-SmbMapping -LocalPath B: -RemotePath \\zx0\intranet
New-SmbMapping : Access is denied.
At line:1 char:1
+ New-SmbMapping -LocalPath B: -RemotePath \\zx0\intranet
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : PermissionDenied: (MSFT_SmbMapping:ROOT/Microsoft/...MSFT_SmbMapping) [New-SmbMapping],
CimException
+ FullyQualifiedErrorId : Windows System Error 5,New-SmbMapping
## FIRST ACCESS TO SERVER ZX0 -- SUCCESSFUL
## AUTHENTICATION MADE AUTOMATICALLY VIA KERBEROS -- USING DOMAIN ACCOUNT
PS C:\Windows\system32> cd \\zx0\intranet
PS Microsoft.PowerShell.Core\FileSystem::\\zx0\intranet> cd .\downloads\
PS Microsoft.PowerShell.Core\FileSystem::\\zx0\intranet\downloads> .\WindowsAdminCenter2103.msi /?
PS Microsoft.PowerShell.Core\FileSystem::\\zx0\intranet\downloads> cd Cert:\LocalMachine
PS Cert:\LocalMachine\> cd my
PS Cert:\LocalMachine\my> ls
## SECOND ACCESS TO SERVER ZX0 -- FAILED
## PATH IS DIFFERENT
PS Cert:\LocalMachine\my> cd \\zx0\home\
cd : Cannot find path '\\zx0\home\' because it does not exist.
At line:1 char:1
+ cd \\zx0\home\
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\\zx0\home\:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS Cert:\LocalMachine\my> cd \\zx0
cd : Cannot find path '\\zx0' because it does not exist.
At line:1 char:1
+ cd \\zx0
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\\zx0:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS Cert:\LocalMachine\my> \\zx0
\\zx0 : The term '\\zx0' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ \\zx0
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (\\zx0:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
PS Cert:\LocalMachine\my> cd \\zx0
cd : Cannot find path '\\zx0' because it does not exist.
At line:1 char:1
+ cd \\zx0
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\\zx0:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
## RETRIED PATH OF EARLIER SUCCESSFUL ACCESS
##
PS Cert:\LocalMachine\my> cd \\zx0\intranet\
cd : Cannot find path '\\zx0\intranet\' because it does not exist.
At line:1 char:1
+ cd \\zx0\intranet\
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (\\zx0\intranet\:String) [Set-Location], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
PS Cert:\LocalMachine\my>
Any ideas what's wrong with it?
Windows for business Windows Server User experience Other
Sign in to answer