People picker settings for all Web Applications one-liner

Summary: This PowerShell one-liner will show the people picker settings for each Web Application, including Central Administration.

If you want to know the settings for the people picker in your SharePoint farm, you can run the following line of PowerShell.
It will retrieve all Web Applications and show the people picker settings for each one.

Get-SPWebApplication -IncludeCentralAdministration | %{Write-Host $_.url; $_.peoplepickersettings | select * | fl }

Running the one-liner will result in something like this:

People picker settings

Add PDF mimetype for all Web Applications oneliner

By default, PDF files cannot be opened directly from SharePoint 2010/SharePoint 2013.

To add the PDF mimetype to all Web Applications (Instead of doing it seperately for each Web Application), you can use the following oneliner:

Get-SPWebApplication | %{$_.AllowedInlineDownloadedMimeTypes.Add("application/pdf");$_.Update()}

Site collection creation time using PowerShell

This script will show you the site collection creation time for each site collection using PowerShell.
Try the following oneliner to get all the information you need:

Get-SPSite -Limit All | %{$root = $_.rootweb; $date = $root.created.toShortDateString(); Write-Host "$($root.url) was created on $($date)"}

Site collection creation time

Content Databases per Web Application oneliner

Another one in the series of oneliners. This one will show you all Web Applications, and all associated Content Databases for these Web Applications:

Get-SPWebApplication | %{Write-Output "`n- $($_.url)"; foreach($cd in $_.contentdatabases){Write-Output $cd.name}}

The output will look similar to this:Get Content Databases per Web Application onelinerYou can output this to a text file by running the following:

Get-SPWebApplication | %{Write-Output "`n- $($_.url)"; foreach($cd in $_.contentdatabases){Write-Output $cd.name}} >> <strong>D:filename.txt</strong>

Current cache accounts PowerShell oneliner

This oneliner will show you the currently configured cache accounts for each of your Web Applications. Just paste this line of code in your SharePoint Management Shell:

Get-SPWebApplication | %{Write-Host "Web Application: " $_.url "`nSuper user: " $_.properties["portalsuperuseraccount"] "`nSuper reader: " $_.properties["portalsuperreaderaccount"] "`n"}

This is the output for the above command in my test environment:

Current cache accounts PowerShell oneliner

In my case, I have not properly configured the super user accounts for all my Web Applications.

Be aware that misconfigured super user accounts can lead to access problems. You may not be able to access your SharePoint Web Application!

Get Site Collections per Content Database oneliner

This will be a very short post, as it contains only 1 line of PowerShell code, and is not very hard to understand. It shows you all content databases, and for each of the content databases, it will show you the site collections within this content database.

Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}}

That wasn’t so bad right? Just copy and paste this code into your SharePoint Management Shell (As administrator), and let PowerShell do your work for you!

Get Site Collections per Content Database oneliner

Now let’s say you want to save this output to a .txt file, you can add

> C:sitecollections.txt

The full command would be:

Get-SPContentDatabase | %{Write-Output "- $($_.Name)”; foreach($site in $_.sites){write-Output $site.url}} > C:sitecollections.txt

This would create a .txt file with the same information:

Get Site Collections per Content Database oneliner 2

That’s all there is to it!