Get SharePoint 2010 Managed paths with PowerShell

You created an environment with a couple of web applications that each have their own unique managed paths. With this PowerShell code you can view which managed paths you have used for each web application. You dont have to click trough SharePoint 2010 anymore.

This oneliner gets all managed paths per web application:

get-spwebapplication | %{$url = $_.url; write-host “`nWeb app: $($_.url)”; get-spmanagedpath -webapplication $_ | %{write-host ”     Type: $($_.type) – url: $($url)$($_.name)”}}

 

It first gets all web applications and displays the url, then it will get all managed paths per web application and displays the type and url.

image

Get SharePoint 2010 SMTP Server with PowerShell

Because we monitor a lot of SharePoint servers we dont want to click through central admin if we want to know if anything has changed. The SMTP server is also something that we want to see with our summary script.

There are a couple of ways to get the SMTP Server name:

1. Using Central Administration

When navigating to ‘Central Administration –> System Settings –> Configure outgoing e-mail settings’

image

 

2. Using PowerShell

The following line of code can be filled in to get the configured SMTP Server using PowerShell

(get-spwebapplication)[0] | %{$_.outboundmailserviceinstance.server}

 

image

When we put this code with the below posts we already can view SharePoint 2010 edition, version and SMTP Server.

 

image

In the next couple of posts I will expand this script with managed paths, site collections, web applications, size, databases, service applications and solutions.

Get SharePoint 2010 version with PowerShell

As part of the summary script I use the following code to get the SharePoint 2010 version. This identifies which CU or Service Pack has been installed.

There are a couple of ways for getting the build version:

1. Using Central Administration

It is of course possible to get the build version using central administration by going to ‘Central Administration –> System Settings –> Manage servers in this farm’

image

2. Using get-spfarm

You can use the following line of code to get the buildversion

get-spfarm | select BuildVersion

image

3. Using [Microsoft.SharePoint.Administration.SPFarm]::Local

This command outputs the same values as get-spfarm.

([Microsoft.SharePoint.Administration.SPFarm]::Local).buildversion

image

Use .tostring() to get the version as string.

image