Cheatography
https://cheatography.com
SharePoint powershell usefull commands for developers
General Powershell Commands
List the powershell commands |
Get-Command |
Restart IIS Services |
iisreset |
Reference SharePoint Component |
Add-PSSnapin "Microsoft.SharePoint.PowerShell" |
Returns the names of all users who have the SharePoint_Shell_Access role |
Get-SPShellAdmin |
Adds a user to the SharePoint_Shell_Access role for the specified database |
Add-SPShellAdmin {User account name} |
Get the local sharepoint farm |
Get-SPFarm |
List the web applications |
Get-SPWebApplication |
List the site collections |
Get-SPSite |
List the site of a site collection |
Get-SPWeb -Site {url of the site} |
Removes a user from the SharePoint_Shell_Access role |
Remove-SPShellAdmin -Username {Account name} |
List the content databases |
Get-SpDatabase |
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 developers.
SharePoint App Deployment
Imports an app package |
Import-SPAppPackage -Path {Path to .spapp file} -Site {Site collection url} -Source {Source of the app} |
Installs an instance of an app |
Install-SPApp -Web {Web url} -Identity {spapp object returned from import command} |
Uninstalls an instance of an app |
Uninstall-SPAppInstance -Identity {spapp object returned from get-spappinstance command} |
Updates the app instance |
Update-SPAppInstance -Identity $instance -App $spapp |
For import app package command, here are the valid values for Source attribute:
- SharePoint Store
- App catalog
- SharePointService
Timer Job
List jobs of a web application |
Get-SPTimerJob -WebApplication {Web application url} |
Start a job |
Start-SPTimerJob -Identity {Job GUID} |
|
|
Farm Solution Deployment
List the solution of farm solution store |
Get-SPSolution |
List the features of the farm |
Get-SPFeature |
Add a solution to farm solution store |
Add-SPSolution -LiteralPath {Path to .wsp file} |
Install farm solution to a web application |
Install-SPSolution -Identity {.wsp file name and extension} -WebApplication {Web App Url} -GACDeployment; |
Update farm solution to a web application |
Update-SPSolution -Identity {wsp file name and extension} -LiteralPath {Full path of new .wsp file} -GACDeployment |
Uninstall farm solution |
Uninstall-SPSolution -Identity {wsp file name and extension} -WebApplication {web app url} |
Remove farm solution from the store |
Remove-SPSolution -Identity {wsp file name and extension} |
Enable farm solution feature on a site |
Enable-SPFeature -Identity {Feature Name or ID} -Url {Site url} |
Disable farm solution feature on a site |
Disable-SPFeature -Identity {Feature name or ID} -Url {Site url} |
Installs a SharePoint Feature by using the Feature.xml file |
Install-SPFeature -path {name of feature.xml store in hive} |
Uninstalls an installed feature definition |
Uninstall-SPFeature -Identity {Feature name} |
These commands concern farm solution, for SharePoint Application commands please see next block.
Services
List SharePoint Service Instances |
Get-SPServiceInstance -Server {Server name} |
Start instance of a SharePoint Service |
Start-SPServiceInstance {Service GUID} |
Stop instance of a SharePoint Service |
Stop-SPServiceInstance {Service GUID} |
Logs
List the event logs |
Get-EventLog -List |
Reads/queries ULS trace logs |
Get-SPLogEvent |
Retrieves Diagnostic Configuration values |
Get-SPDiagnosticConfig |
Allows setting Diagnostic Configuration values |
Set-SPDiagnosticConfig |
Returns IDiagnosticsLevel2 objects or displays a list of diagnostics levels |
Get-SPLogLevel |
Allows the user to set the trace and event level for a set of categories |
Set-SPLogLevel |
Resets the trace and event levels back to their default values |
Clear-SPLogLevel |
Ends the current log file and starts a new one |
New-SPLogFile |
Combines trace log files from all farm servers into a single file |
Merge-SPLogFile |
All commands who contain SP do actions on SharePoint ULS (Unified Log Service)
|
Created By
vlecerf.com
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets