Powershell无法运行安装

时间:2019-08-21 00:11:32

标签: powershell windows2012

试图将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

得到许多错误。我认为上面尝试过的命令符合expects进程的内容,因此不确定当前在做什么(通常用于linux)。请注意,在上一个命令中,它告诉我\\172.18.4.109\mapr不是文件夹,但是在文件资源管理器GUI中使用“地图网络驱动器”时,我实际上可以挂载此位置。

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

1 个答案:

答案 0 :(得分:1)

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

假设服务器将是“ mapr006”,并且文件夹将安装“ mapr”

New-PSDrive -Name "z" -Root "\\mapr006\mapr" -Persist -PSProvider "FileSystem"

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

mount是别名

PS C:\Users\Juan_Pablo> alias mount

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           mount -> New-PSDrive

您可以使用以下命令查看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

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

C:\WINDOWS\System32\mount.exe mtype=hard -o anon -o nolock -o fileaccess=644 \\mapr006\mapr z:
相关问题