Wednesday, 28 April 2010

Quick Reference for SharePoint PowerShell

There is a good quick reference sheet available for download from PowerGUI at http://bit.ly/a6ZcYi.

PowerShell truly changes how we administer SharePoint. My favourite feature is Remoting, the ability to invoke cmdlets from a remote machine (for eample, your workstation rather than SharePoint server).

Example:

To enable PowerShell remoting on the SharePoint server:

Enable-PSRemoting

To connect to the SharePoint server from your workstation in interactive mode:

Enter-PSSession 'MySharePointServer' -Credential:'Domain\Username'
Add-PSSnapin Microsoft.SharePoint.Powershell

To execute a PowerShell script on a remote server from local machine without opening an interactive session:

$session = New-Session 'MySharePointServer' -
Credential:'Domain\Username'
Invoke-Command $session { your script }

0 comments:

Post a Comment

Feel free to add your comment to this post. All comments are moderated and may not appear immediately within the page.