Get-SPError

05/17/2010

PowerShell

I ran into this the other day when I needed to research an error. I opened up the SharePoint 2010 Management Shell to look at the log events by typing:

Get-SPLogEvent | ?{$_.Correlation -eq “Enter Correlation ID Here”} | ft Timestamp, Category, Message -Autosize

Then I thought to myself, “I don’t want to have to type this each time I have an error”. So, I decided to make it a function, add it to my PowerShell profile, and be done with it. If you would like to do the same, here is what I added to my PowerShell profile:

function Get-SPError ($errorid){
Get-SPLogEvent | ?{$_.Correlation -eq $errorid} | ft Timestamp, Category, Message -Autosize
}

Now, all I have to type when I see the next SharePoint 2010 error screen is this:

Get-SPError “Enter Correlation ID Here”

Ahhhh, much better! 🙂

 

Advertisements

Subscribe

Subscribe to our RSS feed and social profiles to receive updates.

2 Comments on “Get-SPError”

  1. Yuri Says:

    So, how can I edit the PowerShell Profile?
    Thanks.

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: