Functions/Export-PSVersionCommand.ps1

function Export-PSVersionCommand
{
  [CmdletBinding()]
  param
  (
    [Parameter(Mandatory=$false)]
    [string]
    $ComputerName = $env:computername,

    [Parameter(Mandatory=$false)]
    [string]
    $Path = $env:computername,
    
    [Parameter(Mandatory=$false)]
    [string[]]
    $ModuleFilter = '*'
  )
  

Get-Module -CimSession $ComputerName -ListAvailable | Where-Object {

($PSItem.ModuleBase -like "$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules*" -or 
$PSItem.ModuleBase -like "$env:ProgramFiles\WindowsPowerShell\Modules*")

} | Select-Object Name,ModuleBase,Version -PipelineVariable Module | ForEach-Object -Process {

Get-Command -Module $PSItem.Name | Select-Object -Property Name,@{Name=’Parameters’;Expression={(Get-Command $_).Parameters.Keys}},@{Name=’Module’;Expression={$Module.Name}},@{Name=’ModuleVersion’;Expression={$Module.Version}}

} | Export-Clixml -Path $Path
  
}