代码改变世界

查看SharePoint错误的PowerShell命令

2011-08-18 15:47  程序开发助手  阅读(466)  评论(0编辑  收藏  举报

在SharePoint 2010中,经常会遇到如下这个错误:

 

Error

An unexpected error has occurred.

Troubleshoot issues with Microsoft SharePoint Foundation.

Correlation ID: ab4783ca-57dc-4e5c-82da-8d07e17c393f

Date and Time: 8/17/2011 1:53:16 PM

 

 

我们可以用powershell查看错误信息,具体命令如下:

Get-SPLogEvent -StartTime (Get-Date).AddMinutes(-5) | Where-Object {$_.correlation -eq "<guid>"} | Format-List

Note: 最好在所有的机器上都执行一下,因为log不一定会写到哪台机器上。

详细的信息可以参考:

http://www.cnblogs.com/ww3128/archive/2010/12/08/1899748.html

http://www.zimmergren.net/archive/2010/09/03/sp-2010-find-error-messages-with-a-correlation-id-token-in-sharepoint-2010.aspx

http://gvaro.wordpress.com/2010/04/15/even-more-on-correlation-ids-within-sharepoint-2010/

http://www.wictorwilen.se/Post/Working-with-SharePoint-2010-Correlation-ID-in-PowerShell-and-code.aspx

http://blogs.msdn.com/b/spses/archive/2009/12/18/sharepoint-2010-logging-improvements-part-1.aspx