Ever wonder what powershell commandlets exist on your SharePoint 2010 installation? Easy! Just run the SharePoint 2010 Management Shell, and issue the following command -
Get-Command -module Microsoft.SharePoint.PowerShell
And if you wish to find matching commands for a certain task, for instance, I wish to know all commands that have anything to do with “Update”, I would issue the following command -
Get-Command -module Microsoft.SharePoint.PowerShell | where{$_.name -match "Update"}
And if you want to do exactly the same for stsadm, you could do something like this -
C:\Users\Administrator>stsadm | find "feature"
activatefeature
deactivatefeature
installfeature
scanforfeatures
uninstallfeature
C:\Users\Administrator>
Cool huh?
On
2/2/2011 6:11:52 AM
Thomas Svensen
said ..
Nice, but why use that awkward syntax? This is much easier to remember:
Get-Command *-SP*
And
Get-Command *-SPEnterpriseSearch*
For all PowerShell related to Search.
|
On
2/2/2011 1:32:58 PM
Sahil Malik
said ..
And this is why I blog, because people come and tell me better ways of doing things - Thanks Thomas.
|
On
2/3/2011 6:07:00 AM
Michal Brndiar
said ..
Hi Sahil,
thanks for sharing your knowledge. My two cents:
gcm -Noun "SP*"
- returns all commands, whose noun starts with SP (mostly SharePoint :)
gcm -Verb "Get" -Noun "SP*"
- returns all commands, whose verb is "Get" and noun starts with SP
Note: gcm is OTB alias for Get-Command cmdlet.
|
On
2/5/2011 11:45:59 AM
Sahil Malik
said ..
Michal - Thank you for sharing!
|
On
2/6/2011 11:40:27 AM
Prabath Fonseka
said ..
Nice post Sahil.
To get all SharePoint related PowerShell commandlets to a text file.. :)
Get-Command –PSSnapin “Microsoft.SharePoint.PowerShell” | select name, definition | format-list > C:\SP2010_PowerShell_Commands.txt
|
On
3/18/2011 3:28:38 PM
PJM
said ..
Excellent post
|