SharePoint 2010 PowerShell interview questions and answers


General PowerShell Question & Answers

1.     What is windows PowerShell?
Ans: Windows PowerShell is a new Windows command-line shell designed especially for system administrators. In the SharePoint administration context, Windows PowerShell is another administration tool that supersedes the existing Stsadm.exe.

2.     What are comdlets?
Ans: Windows PowerShell introduces the concept of a cmdlet which are simple build in commands that can be used for interacting with SharePoint object model. The commands are similar to .net language like C# or VB

3.     How to load/import SharePoint library/assembly in to windows PowerShell command let?
Ans: The SharePoint assembly can be loaded using partial name or using full path. Find the different way loading details below.
Loading the assembly with partial name:
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

Loading the assembly from installed location:
[System.Reflection.Assembly]::LoadFrom("<installed location of Microsoft.ShrePoint.dll>")

4..     What assembly is to be imported to use SharePoint object model in windows PowerShell?
Ans: The SharePoint object model can be access using Microsoft.SharePoint.DLL. This assembly will be available inside SharePoint hive directory.

5.     Where is PowerShell located in SharePoint 2010?
Ans: On the Start menu, click All Programs -> Click Microsoft SharePoint 2010 Products -> Click SharePoint 2010 Management Shell.

6.     How is Windows PowerShell different from Stsadm ?
Ans: Unlike stsadm, which accept and return text, Windows PowerShell is built on the Microsoft .NET Framework and accepts and returns .NET Framework objects. In addition to that it also gives you access to the file system on the computer so that you can access registry,digital signature certificate etc..

7.     How to Add SharePoint PowerShell sanpin?
Ans: Add-PSSnapin -Name Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

8.     How to remove SharePoint PowerShell snapins?
Ans: Remove-PSSnapin -Name Microsoft.SharePoint.PowerShell

9.     What is the extension of PowerShell script file?
Ans: The PowerShell script file saved as .ps1 (e.g MyScript.ps1)

10.  Can PowerShell commends/scripts be used for deploying components in SharePoint 2010?
Ans: If you are creating a webpart with VS 2010 then you can deploy it using ctrl + f5. However, to activate the webpart feature you can write a powershell script (.ps1) and execute it after dpeloyment.

11.  If you need going to install a webpart or any custom solution in SharePoint 2010 using PowerShell What permissions do you need?
Ans: In order to use Windows PowerShell for SharePoint 2010 Products, a user must be a member of the SharePoint_Shell_Access role on the configuration and content database. In addition to this, the user must also be a member of the WSS_ADMIN_WPG local group on the computer where SharePoint 2010 Products is installed.
12.  How to list all the commands in PowerShell ?
Ans: Get-Command * commands gets you all the Powershell command


No comments:

Post a Comment