Check for free disk space with Powershell

Recently I’ve been asked from a client to create a script to check for free disk space on their SharePoint VMs on a daily basis, no matter if other software, like SCOM, was in place or not.

I created a PowerShell script that checks all drives from a list of servers. If the script detect less 20 GB it sends and e-mail to the SharePoint admin.

See the script below for details. (more…)

List all publishing pages and their associated page layout

I’ve often been asked to get almost any kind of report about SharePoint’s content. This time the customer asked me to get the list of all publishing pages and their page layout in a site collection. This is quite an easy task, of course using PowerShell! It’s just a matter of looping through all SPWebs in the site collections, get the page library content and print some item properties in a text file. Let’s see how to do that.

Since this is just a quick tip take a look to the comments in the script, they should be self explaining :)

(more…)

Enabling content type on multiple SharePoint lists with PowerShell

Enabling content type on multiple SharePoint lists with PowerShell

In a new project I’m working on I had to create a new Content Type and make it available on all the document libraries in the site collection. I had to choices: browse each document library’s settings page and enable the content type via the UI or let PowerShell do it for me. Since I’m really lazy I chose the scripting way.

A few days ago I published the script on TechNet Gallery,Enabling content type on multiple lists with PowerShell. As you can imagine the script enables a content type on each document library in a site collection. It takes three parameters: site, name and list.

(more…)

Populate SharePoint group from User Profile using Powershell

Populate SharePoint group from User Profile using Powershell

Happy new year everyone!! A few days before the end of the year I published a new script on TechNet Gallery about how to populate a SharePoint group reading from User Profiles using Windows Powershell.

I chose to read from User Profiles instead of querying Active Directory because user profiles could have more information than AD since we could add a synchronization connection that reads from BCS or other sources. (more…)

Find computer name and domain using Powershell

Sometimes it’s useful to know the computer name and domain you are working on. More than once I had to google for these commands because I just can’t keep them in mind, so I decided to write a quick post as a reminder. The following are my favorites.

The first one returns the FQDN of the computer on the format whereas the second one returns a list of information about the computer such as NETBIOS name (that could be different from the DNS name), domain name, phisical memory, etc… You can also select single properties, changing the cmdlet this way:

That’s all. As I said before this was a quick one :)
– Riccardo