Show Menu

SharePoint Powershell Developers Usefull Commands Cheat Sheet by

SharePoint powershell usefull commands for developers

General Powershell Commands

List the powershell commands
Restart IIS Services
Reference SharePoint Component
Add-PS­Snapin "­Mic­ros­oft.Sh­are­Poi­nt.P­ow­erS­hel­l"
Returns the names of all users who have the ShareP­oin­t_S­hel­l_A­ccess role
Adds a user to the ShareP­oin­t_S­hel­l_A­ccess role for the specified database
Add-SP­She­llAdmin {User account name}
Get the local sharepoint farm
List the web applic­ations
List the site collec­tions
List the site of a site collection
Get-SPWeb -Site {url of the site}
Removes a user from the ShareP­oin­t_S­hel­l_A­ccess role
Remove­-SP­She­llAdmin -Username {Account name}
List the content databases
IISRESET is a command line utility that you can use in powershell but in command prompt also, this can be usefull in some cases for develo­pers.

SharePoint App Deployment

Imports an app package
Import­-SP­App­Package -Path {Path to .spapp file} -Site {Site collection url} -Source {Source of the app}
Installs an instance of an app
Instal­l-SPApp -Web {Web url} -Identity {spapp object returned from import command}
Uninstalls an instance of an app
Uninst­all­-SP­App­Ins­tance -Identity {spapp object returned from get-sp­app­ins­tance command}
Updates the app instance
Update­-SP­App­Ins­tance -Identity $instance -App $spapp
For import app package command, here are the valid values for Source attribute:
- SharePoint Store
- App catalog
- ShareP­oin­tSe­rvice

Timer Job

List jobs of a web applic­ation
Get-SP­Tim­erJob -WebAp­pli­cation {Web applic­ation url}
Start a job
Start-­SPT­imerJob -Identity {Job GUID}

Farm Solution Deployment

List the solution of farm solution store
List the features of the farm
Add a solution to farm solution store
Add-SP­Sol­ution -Liter­alPath {Path to .wsp file}
Install farm solution to a web applic­ation
Instal­l-S­PSo­lution -Identity {.wsp file name and extension} -WebAp­pli­cation {Web App Url} -GACDe­plo­yment;
Update farm solution to a web applic­ation
Update­-SP­Sol­ution -Identity {wsp file name and extension} -Liter­alPath {Full path of new .wsp file} -GACDe­plo­yment
Uninstall farm solution
Uninst­all­-SP­Sol­ution -Identity {wsp file name and extension} -WebAp­pli­cation {web app url}
Remove farm solution from the store
Remove­-SP­Sol­ution -Identity {wsp file name and extension}
Enable farm solution feature on a site
Enable­-SP­Feature -Identity {Feature Name or ID} -Url {Site url}
Disable farm solution feature on a site
Disabl­e-S­PFe­ature -Identity {Feature name or ID} -Url {Site url}
Installs a SharePoint Feature by using the Featur­e.xml file
Instal­l-S­PFe­ature -path {name of featur­e.xml store in hive}
Uninstalls an installed feature definition
Uninst­all­-SP­Feature -Identity {Feature name}
These commands concern farm solution, for SharePoint Applic­ation commands please see next block.


List SharePoint Service Instances
Get-SP­Ser­vic­eIn­stance -Server {Server name}
Start instance of a SharePoint Service
Start-­SPS­erv­ice­Ins­tance {Service GUID}
Stop instance of a SharePoint Service
Stop-S­PSe­rvi­ceI­nstance {Service GUID}


List the event logs
Get-Ev­entLog -List
Reads/­queries ULS trace logs
Retrieves Diagnostic Config­uration values
Allows setting Diagnostic Config­uration values
Returns IDiagn­ost­ics­Level2 objects or displays a list of diagno­stics levels
Allows the user to set the trace and event level for a set of categories
Resets the trace and event levels back to their default values
Ends the current log file and starts a new one
Combines trace log files from all farm servers into a single file
All commands who contain SP do actions on SharePoint ULS (Unified Log Service)

Help Us Go Positive!

We offset our carbon usage with Ecologi. Click the link below to help us!

We offset our carbon footprint via Ecologi


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          Basic Cisco IOS Commands Cheat Sheet
          Cisco to Junos Cheat Sheet