Using PowerShell in SharePoint 2010 – First steps

Hello @all,

today i play a bit with our new powershell cmdlets in O14.

1) how to get a list of all available cmtlets?
Answer: get-help *
(i prefer to write the output into a text file by: get-help * > c:\o14_pws_cmdlet.txt)

As next step how to create new contentdbs, attach, detach and remove them

2) How to create new contentdb for a web application:
Answer: New-SPContentDatabase

image

e.g: New-SPContentDataBase –webapplication https://o14-4514 –Name o14_4514_WSS_Content_3

image

3) enumerate all contentdbs of one WebApplication:
Answer: GET-SPContentDatabase –webapplication https://o14-4514

image

4) how to detach a contentdb?
Answer: Dismount-SPcontentdatabase –identity <GUID>

image

Note: the contentdb exist still in SQL server.
image

5) how to attach a contentdb?
Answer: mount-SPcontentdatabase –name o14_4514_WSS_content_3 –webapplication <url>

image

The next command is new, please be careful with
6) how to delete a database on SQL server?
Answer: Remove-SPcontentdatabase –identify <guid>

image

image

Now , take a  look on SQL Server: *RIP for “o14_4514_WSS_content_3”, it’s deleted on SQL server
image

Regards

Patrick