2. The goal of this document is to understand
the basics of PowerShell to give you more
Power, more confident and skilled in
SharePoint.
To get a “view” business request done using
Powershell
4. Command Line Utility
Similar to good old DOS command prompt,
but better.
Runs on top of .NET framework
5. No need to retype code across servers
Automate
Do things which cannot be done from Central
Administration
Security
Not to Run scripts by double click or in current
directory to prevent malicious attack
Execution Policy
Restricted,UnRestricted
AllSigned,RemoteSigned etc
No need to memorise.TAB magic
Poweshell ISE(Intellisense,copy/paste,test
partial code)
6. Open PowerShell as administrator in 64 bit
not x86
Find the Command(s) – Get-Command
Get details of the Command(s) – Get-help
Test the command with a Get operation and
filter for a requirement view data
Write a code in a “*.ps1” file to automate
tasks across multiple SharePoint servers
related to Create, Update or Delete data.
7. Verb-Noun
Verb – Get,Set,New,Add,Remove
Noun – “SP” starting
To get all SharePoint commands
Get-command –Module
“Microsoft.SharePoint.PowerShell”
Get-Command *sp*,-verb,-noun
Example you forget the name of the command to
view log files
Type get-command *log*
To iterate through the commands used TAB KEY
8. Get-help [commandName]
Update-help –force
Help about_*
Help [verb]*[searchterm]* –showwindow -
detailed –examples –full –online
Note the parameters you need
9. Command -<ParameterName> <value1>.<value2>
Type any of the examples and test
TAB through Parameters after – symbol
Tab through Paramater values
View Members Get-Member
Filter if needed
Where {$_.Parameter –like “”}
Select param1,param2
Variable assign (Eg)$web = Get-SPWeb
Current Variable $_;Foreach($w in )
Measure to get count of objects
Try{}{ Write-Exception “Exception $_”}
Out-GridView;Export-csv;Format-list;Write-Host