我一直在搜索一段時間,但似乎無法找到正確的答案。當提供Get-CimInstance時,「XML無效」 - 計算機名稱
我的筆記本電腦是AD域的一部分。我用它來探索/開發PowerShell和WMI中的工具。我發現每當我-CimInstance上Win32_ComputerSystem類與-ComputerName
,我得到的XML is Invalid
錯誤:
PS C:\Users\jsung> Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName jsung03-pc
Get-CimInstance : The WS-Management service cannot process the request because the XML is invalid.
At line:1 char:1
+ Get-CimInstance -ClassName Win32_ComputerSystem -ComputerName jsung03-pc
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ParserError: (root\cimv2:Win32_ComputerSystem:String) [Get-CimInstance], CimException
+ FullyQualifiedErrorId : HRESULT 0x80338043,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand
+ PSComputerName : jsung03-pc
jsung03-PC是我的筆記本電腦的主機名。如果我取出-ComputerName
參數,則查詢返回沒有任何問題的結果。
我的筆記本電腦和臺式機上出現同樣的症狀。兩者都運行Windows 7 SP1。我加載了RSAT 4.0和.NET 4.5.2。 WinRM和WsMAN通過Enable-PSRemoting啓用。
PS C:\Users\jsung> $PSVersionTable.PSVersion
Major Minor Build Revision
----- ----- ----- --------
4 0 -1 -1
PS C:\Users\jsung> Get-Service wi*
Status Name DisplayName
------ ---- -----------
Stopped WinDefend Windows Defender
Running WinHttpAutoProx... WinHTTP Web Proxy Auto-Discovery Se...
Running Winmgmt Windows Management Instrumentation
Running WinRM Windows Remote Management (WS-Manag...
如果我刪除-ComputerName jsung03-pc
cmdlet將返回結果W/O錯誤:
PS C:\Users\jsung> Get-CimInstance -ClassName Win32_ComputerSystem
Name PrimaryOwnerName Domain TotalPhysicalMemory Model Manufacturer
---- ---------------- ------ ------------------- ----- ------------
JSUNG03-PC ntapadmin <domain.com> 4147822592 4384BE6 LENOVO
這個問題是不是在查詢 「Win32_Process的」 類中。
Test-WSMan顯示系統正在運行3.0。
PS C:\Users\jsung> Test-WSMan -ComputerName jsung03-pc -Authentication Default
wsmid : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor : Microsoft Corporation
ProductVersion : OS: 6.1.7601 SP: 1.0 Stack: 3.0
我跑了WMI診斷實用程序,並試圖通過cscript WMIDiag.vbs WriteInRepository=Root
但仍沒有運氣恢復存儲庫。幾乎沒有關於XML is invalid
的信息。
任何人都可以闡明什麼數據庫可能會損壞,以及如何解決這個問題?
您是否嘗試過使用Get-WmiObject而不是Get-Ciminstance? – Paul 2014-10-20 21:38:01
PS C:\用戶\ jsung> GET-WmiObject可以-class的Win32_ComputerSystem -computername jsung03-PC 域:hq.netapp.com 廠商:Lenovo 型號:4384BE6 名稱:JSUNG03-PC PrimaryOwnerName:ntapadmin TotalPhysicalMemory :4147822592 – jsung8 2014-10-21 05:00:26
Whymarrh,謝謝你的建議! Get-WMIObject的作品。 但是,這只是我的筆記本電腦和桌面沒有太多的標準。阻止Get-CimInstance -ComputerName在這些Windows 7主機上工作的可能會阻止我的工具部署。我想深入瞭解這個問題。至少,我們應該能夠卸載或修復任何損壞的XML存儲庫......似乎無法在網上找到很多幫助。 – jsung8 2014-10-21 05:09:19