powershell sccm 匯入模組錯誤

powershell sccm 匯入模組錯誤

已從以下位置下載 sccm powershell 模組https://www.microsoft.com/en-us/download/details.aspx?id=46681

透過 .msi 安裝沒有問題。導入時,如下圖所示:

>     Import-Module 'C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1' -Verbose
> 
> Output (first few lines, many more snipped for brevity, then the
> error):
> 
> VERBOSE: Loading module from path 'C:\Program Files (x86)\Microsoft
> Configuration Manager\AdminConsole\bin\ConfigurationManager.psd1'.
> VERBOSE: Loading 'Assembly' from path 'C:\Program Files
> (x86)\Microsoft Configuration
> Manager\AdminConsole\bin\AdminUI.PS.TypeAdapter.dll'. VERBOSE: Loading
> 'Assembly' from path 'C:\Program Files (x86)\Microsoft Configuration
> Manager\AdminConsole\bin\Microsoft.ConfigurationManagement.ManagementProvider.dll'.
> VERBOSE: Loading 'Assembly' from path 'C:\Program Files
> (x86)\Microsoft Configuration
> Manager\AdminConsole\bin\AdminUI.WqlQueryEngine.dll'. VERBOSE: Loading
> 'TypesToProcess' from path 'C:\Program Files (x86)\Microsoft
> Configuration
> Manager\AdminConsole\bin\Microsoft.ConfigurationManagement.PowerShell.Types.ps1xml'.

> VERBOSE: Importing cmdlet 'Clear-CMMigrationData'. VERBOSE: Loading
> module from path 'C:\Program Files (x86)\Microsoft Configuration
> Manager\AdminConsole\bin\AdminUI.PS.DatabaseReplication.dll'.
> Import-Module : Could not load type
> 'Microsoft.ConfigurationManagement.AdminConsole.Common.InvAvailabilityLevel'
> from assembly 'AdminUI.Common, Version=5.0.0.0, Culture=neutral,
> PublicKeyToken=31bf3856ad364e35'. At line:1 char:1
> + Import-Module $CMModulePath -Verbose
> + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>     + CategoryInfo          : NotSpecified: (:) [Import-Module], TypeLoadException
>     + FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand

與該錯誤相關的 DLL 是最近出現的:

PS C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin> dir AdminUI.PS.DatabaseReplication*


    Directory: C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---          4/6/2015   4:00 AM      40112 AdminUI.PS.DatabaseReplication.dll 

看起來安裝失敗,因為我沒有看到任何指令:

PS C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin> Get-Command -Module ConfigurationManager | PS C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin>測量對象

計數: 0 平均值: 總和: 最大值: 最小值: 屬性:

不知道如何從這裡繼續

答案1

看起來問題在於我們運行的 SCCM 是“System Center 2012”而不是“System Center 2012 R2”

經過大量搜尋後,我看到了「System Center Configuration Manager Cmdlet Library」:

此版本支援以下版本的配置管理器:

System Center 2012 R2 Configuration Manager

而原始下載網站說:

支援的作業系統

Windows 7、Windows 8、Windows 8.1、Windows Server 2008、Windows Server 2008 R2、Windows Server 2012、Windows Server 2012 R2

當然,我很高興地嘗試在 Windows 7 上做到這一點。

嘆。看起來我們需要將 SCCM 更新到 R2 才能讓 pwoershell 與其一起工作。

[編輯]發現 SP1 也有 cmdlet,所以我必須讓控制我們 SCCM 伺服器的人員至少升級到該版本...

相關內容