lampShadesDrifter
lampShadesDrifter

Reputation: 4159

Powershell can't run mount

Trying to mount a NFS share onto a Windows 2012 R2 server and unsure of how to interpret errors being thrown.

Running powershell as admin and entering the commands below...

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

getting numerous errors. I think that the commands tried above conform to what the process expects, so not sure what I'm doing wrong at this point (normally used to linux). Note that in the last command, it tells me \\172.18.4.109\mapr is not a folder, but I am actually able to mount this location when using the "Map Network Drive" in the file explorer GUI.

Can anyone with more Windows experience give any advice on debugging tips or what could be going on and how to fix this?

Upvotes: 3

Views: 14966

Answers (1)

Juan Pablo Madriaga
Juan Pablo Madriaga

Reputation: 80

If what you need is simple you can use:

Assuming that the server will be "mapr006" and the folder to mount "mapr"

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

If you need something more complex, I should explain the following:

mount is a alias

PS C:\Users\Juan_Pablo> alias mount

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

you can see the cmdlets available with:

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 does not have all mount options, but you can use "mount" by typing the path of your full location. Assuming that the server will be "mapr006" and the folder to mount "mapr"

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

Upvotes: 6

Related Questions