SharePoint24x7 It's all about SharePoint.

30Dec/140

Tips n Tricks – Navigating through SharePoint ULS logs using PowerShell

Posted by Joy

When troubleshooting SharePoint farms, ULS logs play a vital role. ULS logs are the entry point for both Administrator and Developers when they start investigating an issue in a SharePoint farm.

Usually ULS logs are created in the following directory in SharePoint servers:

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\LOGS

ULS log files are easier to locate among other log files since their file name start with the server name and followed by a the timestamp.

ULS Logs directory

ULS logs contains very detailed information compared to Windows Event Logs. Following is a sample of a ULS log file:

ULS Logs

One of the big challenges/ pain point with regard to ULS logs are reading/ navigating through them. Since they are very detailed, going through them is really challenging. When we open a ULS log file, by default it opens in Notepad and it is really difficult to navigate through them.

Most of us try using lot of 3rd party tools for navigating through ULS logs without knowing that PowerShell also provide a powerful option for us to navigate through ULS logs.

Open SharePoint 2013 Management Shell and issue the following PowerShell command:

Get-SPLogEvent | Out-GridView

PowerShell command

This command will open up a new windows with a Grid View view of ULS log file. This allows us to navigate and filter ULS log entries easily compared to Notepad.

ULS Log Grid View

ULS Log Grid View Filtering

7Jan/140

Tips n Tricks – tweaking the Windows PowerShell Profile

Posted by Joy

Windows PowerShell is the primary scripting tool available for SharePoint Administrators and Developers. Scripting was something most of the developers wanted to stay away from. But now it’s time for all the developers to master Windows PowerShell scripting since it is the core scripting platform from Microsoft. Just like Shell Scripts in Unix and Linux platforms, Windows PowerShell is the key to scripting within Microsoft technology stack.

Let’s get started with Windows PowerShell. Smile

When it comes to writing PowerShell scripts for SharePoint, we have no of tool options:

  • Windows PowerShell console window
  • Windows PowerShell Integrated Scripting Environment (ISE)
  • SharePoint 2013 Management Shell

Most of us who are into SharePoint, always prefer using SharePoint 2013 Management Shell since it loads all the SharePoint cmdlets by loading Microsoft.SharePoint.PowerShell.dll into the scripting environment.

If we are going to use Windows PowerShell console window or Windows PowerShell ISE, we will have to explicitly load the Microsoft.SharePoint.PowerShell.dll by executing following PowerShell command in order to being able to use SharePoint cmdlets.

Add-PSSnapin Microsoft.SharePoint.PowerShell

If you are writing very large, interactive scripts very often, it is probably easier to use the Windows PowerShell ISE, rather than the PowerShell console window or the SharePoint 2013 Management Shell because this provides a better editing and debugging environment. However, downside of using the PowerShell ISE is you will have to load the Microsoft.SharePoint.
PowerShell snap-in into the ISE as well every time you open it. It will be done by using exactly the same script shown above.

If you find yourself using the PowerShell ISE a lot, you can be smart to save your effort and time by adding the SharePoint snap-in automatically when the PowerShell ISE starts. You can do this by tweaking the Windows PowerShell profile.

The Windows PowerShell profile is a Windows PowerShell script file that runs every time you start Windows PowerShell. It has a .ps1 extension like any other normal Windows PowerShell script file. We can put any valid Windows PowerShell cmdlet in it so that they get executed every time we start Windows PowerShell. This is very similar to using Environment variables concept to configure startup options back in Windows Command Prompt tool. The only way in which the PowerShell profile file differs from a normal PowerShell script file is in its file name and file location.

If you are planning to use the PowerShell profile to configure startup cmdlets, as the first step, we need to figure out whether a PowerShell profile already exists on the server. We can figure out whether a PowerShell profile already exists by issuing following command:

Test-Path $profile

Check for profile

Check for profile

If the PowerShell profile already exists, above command will return “True”. If it doesn’t exist, it will return
False”.

If it returns either True or False, (i.e: whether the PowerShell profile exists or not), if you want to find out the default location of the PowerShell profile, you can run the following command:

$profile

Location of the profile

Location of the profile

And then, we can use Windows Explorer to browse to the path returned to make required modifications into the PowerShell profile script file.

If there is no file in that location. it means PowerShell profile does not exists and we need to create a new profile.

Use following command to create a new PowerShell profile if one doesn’t already exist.

New-Item -path $profile -type file

In case, if you receive an error response similar to one shown below as a result of executing the above command, make sure you have the correct folder path already in placed for the command to go and create the script file.

Error creating the profile

Error creating the profile

If the folder path exists and if it does create the PowerShell profile file successfully, you should receive the following response.

Creating the profile

Creating the profile

Use Windows Explorer to navigate to the file location and open the profile script file using any text editor such as Notepad.

Locating the profile

Locating the profile

Enter the following PowerShell command in the file, Save the script file and close the text editor.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction "SilentlyContinue"

Tweaking the profile

Tweaking the profile

Now you are all set to use Windows PowerShell ISE and Windows PowerShell console window to write SharePoint scripts. Now when you open either Windows PowerShell ISE or Windows PowerShell console window, it reads the PowerShell profile script file and load SharePoint PowerShell snap-in automatically.

Happy scripting…!!! Smile

5Mar/121

Article – Microsoft Office 365 Desktop Setup

Posted by Joy

With the introduction of Office 365, I see lot of customers are very interested on moving to the Cloud. If we look at the industry today, majority of customers have any form of Cloud presence – Public, Private or Hybrid.

Some customers have gone completely into either public or private cloud and some are still use both on-premise and online with Hybrid model. No matter which deployment it is, it support content access and collaboration using any devices including Mobile, Tab, Laptop and Desktop.

When we use any platform, first we need to make sure that we meet minimum software requirements for the particular platform in order to unlock full feature set and  there no excuse for Office 365 as well. Office 365 team simplifies our process of getting your desktop configured with minimum software requirements with an automated installation process called Office 365 Desktop Setup.

Office 365 Desktop Setup is an installer that checks for and provides important software updates to keep your system synchronized with Office 365. These updates provide seamless integration and better user experience with Office 365.

Office 365 Desktop Setup helps you to meet following software requirements:

  • Client Operating System – Windows XP SP3 with IE 7 or Windows Visa SP2 or Windows 7 or Windows Server 2008 R2
  • Client Office version – 2007 Office system SP2 or Office 2010

After you have signed in to the Office 365 portal for the first time, you should run the Desktop Setup on your computer. If you are working on multiple devices, make sure run Desktop Setup on all those devices.

How to run Microsoft Office 365 Desktop Setup?

  1. Sign in to the Office 365 portal using your Microsoft Online Services ID. URL for Office 365 portal is https://portal.microsoftonline.com/Default.aspx?lc=1033
  2. In the right side pane, under Resources, click Downloads.
    Resources
  3. Downloads page provides 3 steps for Installing Office Professional Plus, Installing Lync and Running Office 365 Desktop Setup.
    SetupStep1
    SetupStep2
    SetupStep
  4. Got to Step 3 - Set up and configure your Office desktop apps, and click Setup.
    SetupStep3
  5. It prompts you for asking privileges to download and run Desktop Setup, and click Run.
    SetupStart
  6. Desktop Setup will be downloaded.
    SetupDownload
  7. Once Office 365 Desktop Setup started, you need to sign in using your Microsoft Online Services ID.
    SignIn
  8. Once you are logged in, Desktop Setup will start checking the configuration of your desktop against minimum software requirements for Office 365.
    CheckingConfig
  9. It then prompts you with the updated required and you can select which updates you need to install depending on the services your organization has subscribed for. Select the updates you wish to install, and click Continue.
    SetupOptions
  10. You are then prompted to accept license agreement. click I accept.
    AcceptLA
  11. Microsoft Office 365 Desktop Setup will start installing and configuring the updates based on your selection. This may take a few minutes. Get some rest Smile.
    SetupInProgress
  12. Once installation and configuration is finished, it shows following screen with the name of the component installed/ configured and the status. And if there are any additional manual configuration required, following screen also will provide links to TechNet or MSDN articles.
    FinishedSetup

Now you have installed and configured your desktop with minimum software requirements to enjoy Office 365.

Enjoy Office 365 Smile.

28Dec/110

Enabling Developer Dashboard in SharePoint 2010

Posted by Joy

ASP.NET provides Call Stack and Tracing as wonderful features which helps developers on investigating what is going on page rendering behind the scene. SharePoint being a product which provides bunch of features OOTB which we can use to setup a portal very easily, it hides most of these information.

Back in MOSS 2007, we had to scratch our head thinking where to start our investigation when we get an error in the browser, because that error was not descriptive enough for us to start the investigation.

In SharePoint 2010, we have a nice feature – Developer Dashboard which helps developers to be comfortable when they see an error in the browser.

Enabling Developer Dashboard

Developer Dashboard is a feature targeted for developers (administrators as well) and hence it is disabled by default. We need to enable it using one of the method mentioned below:

  • STSADM
  • PowerShell
  • SharePoint Object Model
STSADM

We still can use STSADM with SharePoint 2010 for administering SharePoint. However, STSADM is more likely to disappear in the next release. Though we can use following STSADM command to enable Developer Dashboard, I strongly recommend to get familiar with PowerShell, if you are not already.

  1. Go to the command prompt and make sure to either set the path to the location of STSADM.EXE or navigate to the bin directory in SharePoint root in your command prompt.
  2. Issue the following command in the command prompt:STSADM -o setproperty -pn developer-dashboard -pv ondemand

The above command will enable the Developer Dashboard in On Demand mode.

PowerShell
  1. Go to Start –> All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Management Shell
  2. Issue the following command in the management shell:$devdash = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings;
    $devdash.DisplayLevel = ‘OnDemand’;
    $devdash.TraceEnabled = $true;
    $devdash.Update()

The above command will enable the Developer Dashboard in On Demand mode.

SharePoint Object Model
  1. Create a Console Application, Windows Application or Web Site and add a reference to the Microsoft.SharePoint.dll assembly.
  2. Add using Microsoft.SharePoint.Administration namespace reference at the top of the code (C#) file.
  3. Add the following code into your code (C#) file to enable Developer Dashboard:SPWebService svc = SPContext.Current.Site.WebApplication.WebService;
    svc.DeveloperDashboardSettings.DisplayLevel = SPDeveloperDashboardLevel.OnDemand;
    svc.DeveloperDashboardSettings.Update();

The above command will enable the Developer Dashboard in On Demand mode.

I have used On Demand as the setting for Display Level of the Developer Dashboard and following are the other options we can specify:

  1. On – Enable the Developer Dashboard all the times
  2. Off – Disable the Developer Dashboard
  3. OnDemand – Enable the Developer Dashboard but will be displayed on demand.

When you enable Developer Dashboard in On Demand mode, following icon will be displayed next to your login name.

Capture1

On click of the Developer Dashboard icon, page will be reloaded and Developer Dashboard will be displayed at the bottom of the page as shown below:

Capture2

If you have also used TraceEnabled = $true switch with PowerShell, then you will see a link says “Show or hide additional tracing information …” at the end of the Developer Dashboard which allows you to show/ hide ASP.NET Tracing information as shown below:

Capture3

Isn’t this a awesome feature for you to get started your investigation exercise? Have a closer look at what Developer Dashboard offers you and it will help you in numbers of ways.

21Jul/110

Introducing Edit Control Block (ECB)

Posted by Joy

Most of us who use SharePoint product have been using following menu a number of times. But how did you refer to this menu? How do you call this menu? I have heard people call this menu as "this drop down menu", "this document specific menu", "this item specific menu", "this document edit menu", "this item edit menu", etc…

What is the actual name for this flying menu when you click the down arrow next to the item/ document Name?

This is called "Edit Control Box (ECB)". Now onward, you guys should get used to using this right name instead of calling it "this menu", "that menu", etc…

Edit Control Block (ECB)

Edit Control Block (ECB)