¿Cómo puedo recuperar los comandos disponibles de un módulo?
Para saber qué módulos de powershell están disponibles en una máquina, utilizo el comando
Get-Module -ListAvailable
Esto devuelve una lista con module-type, -name y los comandos exportados. Pero los comandos exportados siempre están vacíos y solo se muestran {} ¿Por qué no se muestra esto? ¿Tengo que usar otro parámetro o hay otro cmdlet o método para recuperar los comandos disponibles?
53
3 answers
Los comandos exportados no están disponibles si el módulo no está cargado. Primero debe cargar el módulo y luego ejecutar get-command:
Import-Module -Name <ModuleName>
Get-Command -Module <ModuleName>
87
Author: Shay Levy,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-06-15 07:37:48
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-06-15 07:37:48
Utilice el parámetro -ListAvailable
Get-Module <moduleName> -ListAvailable | % { $_.ExportedCommands.Values }
"<moduleName>
" es opcional. Omita para mostrar todos los módulos disponibles.
11
Author: user2095160,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-11-14 04:57:53
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-11-14 04:57:53
PoSH 2.0 - esto funciona para mí:
Get-module | % {{_.Comandos exportados.Valores}
Para listar los módulos cargados en la sesión actual:
Get-module
-1
Author: user1390375,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-08 17:00:02
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-08 17:00:02