# Installing Pydio through Powershell DSC

Powershell Desired State Configuration (DSC) is relatively new but wow, it is so powerful! I’ve had troubles getting Pydio up and running in the past, so I created a consistent configuration file to get it working.

Simply save the file as pydio.ps1 and run it on the target server. Make sure to download the prerequisite files (PHP, VC++ 2012 Redistributable, PHP Manager for IIS) and put them in an accessible location.

# vSphere multipathing report

The following script generates a report of all datastores and their multipathing policy. This was extremely useful when fixing up some datastores to use best practices with our 3PAR systems.

Run with:

.\multipathing.ps1 -vCenter vcenter.domain.com -VMHost esxi.domain.com

# Meeting Room Utilization

I had a request from a user to find out the meeting room utilization across our head office, but unfortunately I couldn’t find an easy way to do this with Exchange 2010 cmdlets. Here are some instructions to do so with COM objects, PowerShell and Excel.

First create a mailbox that will have the meeting room rights assigned to it, then grant the user access to the required mailboxes so that they show in Outlook:

Get-Mailbox meetingroomprefix* | Add-MailboxPermission -AccessRights FullAccess -User temporarymailbox

Open Outlook and add the meeting room mailboxes, then run the PowerShell script below with the appropriate date range. Mine shows the last financial year.

Next, open the CSV output file in Excel then:

1. Create new sheet called Report
2. Insert a pivot table containing all the data from the raw data sheet
3. Drag “MeetingRoom” to Rows
4. Drag “Duration” to Values. Edit the field settings to be “Count” and rename to “Number of Meetings”
5. Drag “Duration” to Values. Edit the field settings to be “Sum” and rename to “Total Duration”
6. Create two new fields – one with the amount of work weeks per year (48.775 for mine) and the amount of hours per week (40 for mine).
7. Create a new table for utilization percentages. Put the formula as =C5/($E$5*$E$9*60).

# Change SMTP settings on Xerox machines with PowerShell

I got really sick of changing SMTP settings on Xerox machines manually, so I made a PowerShell script to make it easier. The script can also pull a list of printers from a print server and work from that.

Just change the variables up the top and run the script.

It could be further optimized with PowerShell workflows so it works on each concurrently, but I was lazy.

# Sign-PSScript

Just a quick function to sign PowerShell scripts with a code-signing certificate. Very useful for deploying scripts in a domain to all computers without changing the execution policy.

Throw it in your \$profile, reload, run with Sign-PSScript -Script c:\path\to\script.ps1.

# Get-MailboxSizes

This script produces a simple report to get the mailbox, archive and total sizes in a mailbox database. This helps with estimating space needed for mailbox moves.

To use, just load it up then use Get-MailboxSizes -Database DBName.

# Getting mailbox database sizes

I’m not too sure why this isn’t exposed through the Exchange cmdlets, but here we go.

Run with Get-DatabaseSize -Database DatabaseName and it will return the database name, server, and database size in megabytes.

EDIT: well, it turns out you can just use Get-MailboxDatabase -Database DatabaseName -Status | select name,server,databasesize. Rookie error on my part.

# meetingroomhud

I’ve just pushed a little project to GitHub. It uses Powershell, Exchange EWS API and D3 to make a little timeline of calendar appointments for meeting rooms.

https://github.com/jacobludriks/meetingroomhud

Feel free to give it a try and see if you hit any bugs.

# Getting Kerberos token size with Powershell

I ran in to an issue with a user getting a 400 error on an IIS server. Turns out it was related to a large Kerberos token size due to being in too many groups. Here is a little script to enumerate the information you need to determine the token size:

This is all outlined in Microsoft KB327825 and relates to Microsoft KB2020943.

# Downloading from YouTube using Powershell

EDIT: As of 12/05/2016 this no longer works. Please use youtube-dl.exe as an alternative.

Sometimes when I’m travelling I don’t have internet access and I want to take videos with me. Here is a script to download videos from Youtube using Powershell.

Run the script with .\youtube.ps1 -video https://www.youtube.com/watch?v=videolink. It will ask which quality you want to download in first and then download it to the current directory.

• page 2 of 3