/images/ducttape.png

Script Dumpster: Reporting all files on ESX Datastores

The ProblemI had a customer who was complaining that the simple overview of disks used by VM’s didn’t add up to the amount of data in use on datastores. Simple reasoning being swap files, snapshots etc. etc. , but the customer wanted to see exactly what was causing this… In comes PowerCLI [VMWare’s adaption of PowerShell for their solutions] The ScriptEdit: As I had thought at first instance, the datacenter name was working just fine on my 2 test environments, but in a 3rd I quickly ran into an error.

Going on a Get-Date…part 1

Simple issues, simple solutions?Recently I’ve been doing quite some break-fix cases, which didn’t quite make blogging a high priority. It did on occasion provide me with nice little gems that I decided to spend a little personal time on, because I thought it would be better to force myself to use PowerShell instead of resolving things manually or through a GUI. Also, I thought these issues would be “simple, quick solutions”, which turned out to be a bit too optimistic.

The case of the disappearing e-mail…

One of my customers was running into an odd case of disappearing e-mails. They have an on-premise Exchange 2010 mail server on which they have a Shared mailbox to which all employees have access. Now all of a sudden mails that are moved/copied TO this shared mailbox mysteriously disappear… First thing that came to mind: Rules! Bring in the ShellFirst of all I needed to check if there weren’t any Server side rules which were configured, which you can easily do with the following command:

Scheduled Tasks - PowerShell Scripts with Parameters

Perhaps a very “simple” issue, but I noticed that when looking for this it took me longer than expected to find the result I had in mind. The issue at handI have a script which requires various parameters to be provided so that I can run it. When running the command through an active console session it would look like this: 1 .\Get-MailboxAuditLoggingReport.ps1 -Mailbox ProblemMailbox -Hours 24 -SendEmail -MailFrom administrator@contoso.com -MailTo administrator@contoso.

Migrating scheduled tasks from 2008 to 2012+

Today I was busy with a customer who needed to migrate some Scheduled Tasks from his Windows Server 2008 to his new Windows Server 2012 R2 machine. Slight issue, there were 139!! Scheduled Tasks [generating reports and sending them to various sources]. There’s no way I was going to do this manually, so let’s start up my favourite tool for the job: PowerShell! I immediately ran into the first issue: There are no PowerShell cmdlets for Windows 2008 concerning Scheduled Tasks, so you’re limited to the built in command SchTasks, however this can be a troublesome parsing etc.

Script Dumpster: Clean-RedirectedRecycleBin

The problemRedirected Folders on RDS Session hosts tend to cause a specific issue: Each user’s set of Redirected Folders creates their own Recycle Bin entry, which can grow quite a bit. The following function can display a list of files contained within the Recycle Bins older than the provided age. Even better, the script has a switch parameter Remove which does exactly what you think it does 🙂 Through a scheduled task you can run this script on a regular basis when required.