Powershell无法运行挂载

lam*_*ter 3 powershell windows-server-2012-r2

尝试将 NFS 共享挂载到 Windows 2012 R2 服务器上,但不确定如何解释抛出的错误。

以管理员身份运行 powershell 并输入以下命令...

PS C:\Windows\system32> whoami
domain\myuser


PS C:\Windows\system32> mount -o nolock mapr006:/mapr z:
New-PSDrive : Parameter cannot be processed because the parameter name 'o' is ambiguous. Possible matches include:
-OutVariable -OutBuffer.
At line:1 char:7
+ mount -o nolock mapr006:/mapr z:
+       ~~
    + CategoryInfo          : InvalidArgument: (:) [New-PSDrive], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.NewPSDriveCommand



PS C:\Windows\system32> mount mapr006:/mapr z:

cmdlet New-PSDrive at command pipeline position 1
Supply values for the following parameters:
Root: mapr006:/mapr
mount : Cannot find a provider with the name 'z:'.
At line:1 char:1
+ mount mapr006:/mapr z:
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (z::String) [New-PSDrive], ProviderNotFoundException
    + FullyQualifiedErrorId : ProviderNotFound,Microsoft.PowerShell.Commands.NewPSDriveCommand



PS C:\Windows\system32> get-alias mount

CommandType     Name                                               ModuleName
-----------     ----                                               ----------
Alias           mount -> New-PSDrive



PS C:\Windows\system32> New-PSDrive Z -PsProvider FileSystem -Root \\mapr006\mapr
New-PSDrive : The specified drive root "\\mapr006\mapr" either does not exist, or it is not a folder.
At line:1 char:1
+ New-PSDrive Z -PsProvider FileSystem -Root \\mapr006\mapr
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ReadError: (Z:PSDriveInfo) [New-PSDrive], IOException
    + FullyQualifiedErrorId : DriveRootError,Microsoft.PowerShell.Commands.NewPSDriveCommand



PS C:\Windows\system32> New-PSDrive Z -PsProvider FileSystem -Root \\172.18.4.109\mapr
New-PSDrive : The specified drive root "\\172.18.4.109\mapr" either does not exist, or it is not a folder.
At line:1 char:1
+ New-PSDrive Z -PsProvider FileSystem -Root \\172.18.4.109\mapr
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ReadError: (Z:PSDriveInfo) [New-PSDrive], IOException
    + FullyQualifiedErrorId : DriveRootError,Microsoft.PowerShell.Commands.NewPSDriveCommand
Run Code Online (Sandbox Code Playgroud)

出现很多错误。我认为上面尝试的命令符合进程的期望所以不确定我现在做错了什么(通常用于linux)。请注意,在最后一个命令中,它告诉我\\172.18.4.109\mapr这不是一个文件夹,但在文件资源管理器 GUI 中使用“映射网络驱动器”时,我实际上能够挂载此位置。

任何有更多 Windows 经验的人都可以提供有关调试技​​巧或可能发生的情况以及如何解决此问题的建议吗?

小智 6

如果您需要的很简单,您可以使用:

假设服务器为“mapr006”,要挂载的文件夹为“mapr”

New-PSDrive -Name "z" -Root "\\mapr006\mapr" -Persist -PSProvider "FileSystem"
Run Code Online (Sandbox Code Playgroud)

如果您需要更复杂的东西,我应该解释以下内容:

mount 是别名

PS C:\Users\Juan_Pablo> alias mount

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           mount -> New-PSDrive
Run Code Online (Sandbox Code Playgroud)

您可以看到可用的 cmdlet:

PS C:\Users\Juan_Pablo> get-command *nfs*

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Cmdlet          Get-NfsUser                                        11.5.0.... VMware.VimAutomation.Storage
Cmdlet          New-NfsUser                                        11.5.0.... VMware.VimAutomation.Storage
Cmdlet          Remove-NfsUser                                     11.5.0.... VMware.VimAutomation.Storage
Cmdlet          Set-NfsUser                                        11.5.0.... VMware.VimAutomation.Storage
Application     nfsadmin.exe                                       10.0.19... C:\WINDOWS\system32\nfsadmin.exe
Application     nfsclnt.exe                                        10.0.19... C:\WINDOWS\system32\nfsclnt.exe
Application     nfsmgmt.msc                                        0.0.0.0    C:\WINDOWS\system32\nfsmgmt.msc
Run Code Online (Sandbox Code Playgroud)

New-PSDrive 不具有所有安装选项,但您可以通过键入完整位置的路径来使用“安装”。假设服务器为“mapr006”,要挂载的文件夹为“mapr”

C:\WINDOWS\System32\mount.exe mtype=hard -o anon -o nolock -o fileaccess=644 \\mapr006\mapr z:
Run Code Online (Sandbox Code Playgroud)