Monday, March 23, 2015

Powershell Commands in daily use


PowerShell Commands in daily use


1.   To add SharePoint module in windows power shell
Add-pssnapin  Microsoft.sharepoint.powershell

2.   To add IIS module in windows power shell
Import-module web administration




Help Commands:




1.   Get-help

2.   Get-help *backup*( *get all the commands of backup, we can change this by different nouns)
     Get-Help Get-SPSite -Full
     Get-Help Get-SPSite -examples( Provides all the Examples of commands)

3.   Get-verb(to get all the verbs)

4.   Get-command(to get all the commands)
     get-command - noun sp*( to get only commands of SP)
     get-command -verb get*(to get only commands of get)....EX set*, update*

5.   Get-command –pssnapin Microsoft.sharepoint.powershell(to get only SharePoint commands)

6.   Commands will normally start in  verb-noun

7.   Show-command( shows all the commands in new window)

8.   The noun for sharepoint cmdlets will always starts with SP.

9.   gcm -verb get  –noun sp*( gives all the get sharepoint cmdlets).gcm is alias for get-command

10.           gcm  get-sp*( gives all the get sharepoint cmdlets)

11.           help get-spsite(provides the syntax of command for the Get-spsite)

12.           help get-spsite  -full (provides very detailed syntax of command for the Get-spsite)

13.           update-help(command to install all the help commands from internet to local system)

14.           get-help get-spsite –showwindow( shows the help commands in a new window)

15. If you know the noun but are unsure of the possible verbs available, you can enter the noun with -? to display the available verb-noun combinations. This also displays additional nouns that are similar to the one you provided. For example, SPSite -? displays the available 

16.If you have been entering several commands in a console screen, pressing the F7 function key displays a menu of the previously executed commands


 
Property values:
Select is the value that use to get the properties .
Select-object
Select *
EX: get-spweb http://expertsharepoint.blogspot.de | select *(will provide all the properties of the web)
get-spweb http://expertsharepoint.blogspot.de | select URL, site groups, roles*(will provide the properties which we mentioned)
Get-member  is the value that use to get the properties
Conditional Operators:
If,elseif,else
Switch
Constructs:
While, do while, for, do until, Foreach

Aliases:



    Start-sleep: sleep
Comparison operators:



Variables:

Out-grid view is the command to open data in Out file
Third party power shell Editors:
Power GUI – http://powergui.org
Power shell plus : http://idera.com
New In SharePoint 2013 Cmdlets:
Short cut keys:
Ctrl+J = to open the snippets
Power shell commands available on SharePoint Online:
How to setup SharePoint online management shell:
https://technet.microsoft.com/en-us/library/fp161372.aspx

 


I hope the above information will help you to resolve the issue, in case of any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues, Thank you.

ShareThis

X