This project is read-only.
Project Description
PowerShell repo for SharePoint 2013 admins who are not real powershell heroes.
Lot's of functions to automate the provisioning of MySites, content databases etc


Welcome to my SharePoint 2013 PowerShell code project for Sysadmins.
The code in this project is mostly or all written by me for my colleagues who are experienced system administrators but are struggling to write their own functions for administering SharePoint 2013. I've shown some of the functions to other people and it was brought to my attention that this code could be of help for other admins too so I decided to share the code and make it public domain.

It's nowhere near perfect and was never intended for use outside my own company so please keep that in mind when using some or all of the functions.


In order for my colleagues to distinguish our own functions from the standard PowerShell functions i've decided to start all the functions with "SP-", followed by a verb and noun. Also, most of the functions come with help and example code included.
The functions are made with automation of mysite database creation and load balancing and provisioning as much as possible for our own environment. Change to your liking. :)

Shortlist of available functions

*Function SP-Initialise
- Call this function first to get information for all functions set-up.

*Function SP-CheckContentDatabaseForUpgrade
- Checks all content databases and reports if they need to be upgraded

*Function Sp-ClearConfigCache
- Clears config caches on all servers in the SharePoint farm

*Function SP-CreateMySite
- Can be used to provision My Sites. Just provide a username and off you go.

*Function Sp-CreateMySitesFromCSV
- Export a set of users to a file and provision users from there. Usefull when you don't have a firewall port open to a domain controller and can't use get-aduser to retreive a userlist.

*Function Sp-FindDBWithMultipleCollections
- In my company we chose to put each site collection in a different database. Using this function you can find out which databases have multiple site collections

*Function Sp-FindSite
- Searches all collections to find a site name.

*Function Sp-GetAllSiteOwners
- Gets all site owners from a site

*Function SP-GetBuildNumber
- Quickly get the build number of your sharepoint farm

*Function SP-GetEmptyContentDatabases
- Find empty content databases

*Function Sp-GetSPSitesFromDatabase
-Show all sites in a given database

*Function SP-GetUserStats
-Retrieve all sites created by a given user. optionally send them an email

*Function Sp-GetWebStatistics
- Returns all sites that haven't been touched since a certain date. (configurable)

*Function SP-ManageMySiteDBs
-When pre-provisioning all mysites, make sure there are always enough databases available to place MySite's in.

*Function SP-RemoveMySite
-Removes a MySite from the MySite collection

*Function SP-ResetAllDBDefaults
- Can be used to reset pre-provisioned database thresholds

*Function SP-RunPSConfig
- Allows you to run the PSconfig after upgrading without the hassle of remembering all the switches

*Function Sp-SendStatistics
-Get all SharePoint webs with owners and size. optionally send email to admins or managers

*Function SP-SetAllContentDBOffline
- Used to set all databases to offline to prevent any new content databases to be created automatically. You can use it in combination with SP-ManageMySiteDBs

*Function SP-UpgradeAllContentDatabases
- After updating sharepoint you can call this to upgrade all databases to the latest version

I hope to document the functions a bit better in the future. If you have any questions or additions do not hesitate to contact me.


Marco Gombert.

Last edited May 2, 2016 at 2:32 PM by ITMarco, version 6