De 32 bits do Powershell:Use o ServerManager módulo?
-
12-12-2019 - |
Pergunta
Estou a trabalhar com um aplicativo de 32 bits que pode executar powershell trechos.Eu preciso carregar a ServerManager
módulo, o que eu faria normalmente com:
Import-Module ServerManager
Mas eu recebo este erro:
O módulo especificado 'ServerManager' não foi carregado porque não válida módulo arquivo foi encontrado em qualquer diretório do módulo.
Eu assumo, é porque o ServerManager módulo não existe em versões de 64 bits diretório de módulos, então eu tentei o seguinte:
Import-Module "C:\Windows\sysnative\WindowsPowerShell\v1.0\Modules\ServerManager"
Mas agora eu recebo o erro:
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
Alguma sugestão de como eu poderia usar o ServerManager módulo de dentro de 32 bits powershell?Ou outra sugestão de como eu poderia instalar o "Desktop Experience" recurso Server 2008 R2 (sem usar a INTERFACE do usuário)?
Solução
Sua única escolha real aqui é para gerar uma instância de 64 bits powershell.exe para seu processo de comandos do gestor de servidor.Porque o processo pai é de 32 bits, você terá que usar o mesmo %windir%\sysnative
truque para lançar powershell.exe.
%windir%\sysnative\windowspowershell\v1.0\powershell.exe
-command '& { ipmo servermanager; add-windowsfeature foo }'
(moldado para maior clareza)