Pregunta

Estoy trabajando con una aplicación de 32 bits que puede ejecutar fragmentos de PowerShell.Necesito cargar el módulo ServerManager, que normalmente haría con:

Import-Module ServerManager

pero recibo este error:

El módulo especificado 'ServerManager' no se cargó porque no se encontró un archivo de módulo válido en ningún directorio del módulo.

Supongo que esto se debe a que el módulo ServerManager no existe en el directorio de los módulos de 64 bits, por lo que he intentado lo siguiente:

Import-Module "C:\Windows\sysnative\WindowsPowerShell\v1.0\Modules\ServerManager"

Pero ahora recibo el error:

Import-Module : Cannot load Windows PowerShell snap-in C:\Windows\assembly\GAC_MSIL\Microsoft.Windows.ServerManager.PowerSh
ell\6.1.0.0__31bf3856ad364e35\Microsoft.Windows.ServerManager.PowerShell.dll because of the following error: Unable to load
 one or more of the requested types. Retrieve the LoaderExceptions property for more information.
Loader Exceptions: 

Could not load file or assembly 'Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856
ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856
ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856
ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856
ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856
ad364e35' or one of its dependencies. The system cannot find the file specified.
Could not load file or assembly 'Microsoft.Windows.ServerManager, Version=6.1.0.0, Culture=neutral, PublicKeyToken=31bf3856
ad364e35' or one of its dependencies. The system cannot find the file specified.
At line:1 char:14

¿Alguna sugerencia sobre cómo podría usar el módulo ServerManager desde el más de 32 bits Powershell?U otra sugerencia sobre cómo podría instalar la función 'Experiencia de escritorio' en el servidor 2008 R2 (sin usar la UI)?

¿Fue útil?

Solución

Su única opción real aquí es generar una instancia de 64 bits de PowerShell.exe para procesar los comandos de su administrador de servidores.Debido a que el proceso principal es de 32 bits, tendrá que usar el mismo truco %windir%\sysnative para iniciar PowerShell.exe.

%windir%\sysnative\windowspowershell\v1.0\powershell.exe 
     -command '& { ipmo servermanager; add-windowsfeature foo }'

(envuelto para mayor claridad)

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top