A Sneak Peak into the List of useful PowerShell Command Prompts

commands

SharePoint is undoubtedly a piece of art and it can drive business organizations of all sizes. However, sometime it causes chaos for its administrators, which leads to frustration and would require a huge amount of time to undergo tedious coding. Before that disappoints you, we want to confirm that there are PowerShell commands that can make the process a walk in the park.

A Stipulation
Before you use PowerShell, let us warn you that it may cause excruciating migraine headaches and dizziness. Protracting exposure this beast can amplify genetic baldness, nearsightedness and nausea. It is advisable that you should at least refrain yourself from operating heavy machinery or driving a SUV. Well…that was a joke,,gotcha!!

But, do ensure you have backups before going further with PowerShell commands.

  • Finding a Correlation ID error:

One of the most annoying bugs that SharePoint administrators will come across is the fierce ‘red X’ with a mysterious correlation ID error. If this is the issue, a SharePoint Administrator must go through the logs and figure out the cause, which is no doubt uniformly boring.

Wouldn’t it be nice if there was a command that will search the log files for the correlation ID?  The command Merge-SPlogfile will automatically search the logs for the error ID. Better than that, the command will search ALL the servers in the farm and place a log file on the server that you will the command.  Here is an example of the the Merge-SPlogfile command:

What if there was a command that could find out all the log files for the correlation ID? Wait! There is actually one. The command Merge-SPlogfile will involuntarily search the logs a foe a specific error ID.  Bliss is the above command can search your entire firm’s server and can place a log file. This is how the Merge-SPlogfile command work.

Merge-SPLogFile -Path -Correlation <Guid>

(Our SharePoint Developers generally run the command like above using the Correlation ID from sample error above.)

Merge-SPlogfile –Path c:\log.log –Correlation ba05e237-0680-403a-b9f6-e49f96ac55d4

(That will put a .log file on the C drive of the server which will only include errors with the correlation ID.)

Quickly restore a deleted site collection. Strictness Miscommunication

The other day our OffShore SharePoint developers were asked for help by a client, who accidentally deleted a core site. It was very important for him to get it restored ASAP!! Our developers were frenzied hear the story, which was like this “Hi there, I accidentally deleted my site and the irony is I deleted the files from the TRASH. I don’t know the process to restore the from this point, please help”

Luckily, one of our fellow mates murmured a spell, which was “Ha…It’s easy, just use PowerShell to find the site and then restore it”. And this is exactly what we did, which took only 10 minutes.

Here goes the codes, we used luminously:

Get-SPDeletedSite | select Path , siteid

(This will produce a list of all deleted sites and their GUIDs as seen below)

Then, run the command:

Restore-SPDeletedSite -Identity (SITE ID)

(in this case,

Restore-SpDeletedSite –Identity 4bff0c0e-4d56-4fec-8174-a60a16daeaac)

This final command will definitely  restore the site

 This solution is brought to you by Softree Consulting ….

Softree Consulting employs SharePoint consultants, who are experienced in writing for a multiplicity of SharePoint verticals including technical, promotional, creative, branding content, cataloguing and ethical media comprising journalism.

With more than 10 years of industry experience these professionals have the best resources to deliver optimum results. They have been satisfying customers with some of the best SharePoint Strategies. In case you need experts for Offshore development for SharePoint 2016, we have got you covered.

Leave a Reply

Your email address will not be published. Required fields are marked *