0

How does one figure out which windows feature/package provides a given PowerShell cmdlet? An analogue to yum whatprovides and apt-file find on RedHat and Debian based systems.

The cmdlet I specifically need is Set-NfsClientConfiguration: https://docs.microsoft.com/en-us/powershell/module/nfs/set-nfsclientconfiguration?view=win10-ps

I have installed all three packages/features available from Enable-WindowsOptionalFeature that contain the letters NFS and rebooted my machine, but to no avail. They are ClientForNFS-Infrastructure, NFS-Administration and ServicesForNFS-ClientOnly.

1 Answer 1

1

As for this...

How does one figure out which windows feature/package provides a given PowerShell cmdlet?

... just do this...

# List all available modules
Get-Module -ListAvailable

# Get exported commands in a module
Get-Command -Module '*nfs*'

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Function        Disconnect-NfsSession                              1.0        NFS
Function        Get-NfsClientConfiguration                         1.0        NFS
Function        Get-NfsClientgroup                                 1.0        NFS
Function        Get-NfsClientLock                                  1.0        NFS
...

Update as per you comment

If a given module, as per ...

Get-Module -ListAvailable

.. is not on your machine, not returned by the above command, then anything regarding t will be null/return nothing, thus running the cmdlet ...

Get-Command -Module '*SomeModuleNameFromThePreviousCommand*'

... is really moot.

All module is stored and search for your environment paths.

$env:PSModulePath -split ';'

# Results
<#
C:\Users\...\Documents\WindowsPowerShell\Modules
C:\Program Files\WindowsPowerShell\Modules
C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules
...
#>


$env:Path -split ';'

# Results
<#
...
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
...
C:\Program Files\PowerShell\7\
...
C:\Windows\System32\WindowsPowerShell\v1.0\
...
#>

If you installed a module that does not land there, then you need to tell PowerShell explicitly where it is via the Import-Module cmdlets.

The default installed modules available to all users are here:

C:\Windows\System32\WindowsPowerShell\v1.0\Modules

... which is where you should find the NFS module.

C:\Windows\System32\WindowsPowerShell\v1.0\Modules\NFS
1
  • The output of that second command is empty on my machine. Does it only work on already installed packages?
    – Rovanion
    Commented Jun 22, 2020 at 14:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .