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.

Comment and share

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

Comment and share

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).
meetingroom.png

Comment and share

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.

Comment and share

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.

Comment and share

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.

Comment and share

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.

Comment and share

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.

Comment and share

Jacob Ludriks

author.bio


author.job