Domanda

Sto lavorando con un'applicazione a 32 bit che può eseguire snippet PowerShell.Ho bisogno di caricare il modulo ServerManager, che dovrei normalmente con:

Import-Module ServerManager
.

Ma ottengo questo errore:

Il modulo specificato "ServerManager" non è stato caricato perché nessun file di modulo valido è stato trovato in nessuna directory del modulo.

Presumo, questo perché il modulo serverManager non esiste nella directory dei moduli a 64 bit, quindi ho provato quanto segue:

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

Ma ora ottengo l'errore:

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
.

Qualsiasi suggerimento su come posso utilizzare il modulo ServerManager da un powerShell a 32 bit?O un altro suggerimento su come poter installare la funzione 'Experience Desktop' su Server 2008 R2 (senza utilizzare l'UI)?

È stato utile?

Soluzione

La tua sola scelta reale qui è quella di generare un'istanza di 64 bit di PowerShell.exe per elaborare i comandi del server Manager.Poiché il processo genitore è a 32 bit, dovrai utilizzare lo stesso trucco %windir%\sysnative per avviare PowerShell.exe.

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

(avvolto per chiarezza)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top