Getting your geek on with Get-SMJob (Part 1)

Why Get-SMJob is cool

The other day, I got a call from a colleague wanting to get some report out to a customer. Being the PowerShell lover he is, he wanted a simple way to get the information without having to bounce into a UI and a PowerShell module. The questions he raised were simple, and I wanted to show you how easily we addressed them here.

The Question

“Hey Doug, I have lots of different job types going on at a customer site, but I only want to see how my PST migrations are doing. Actually, I only want to see the items that have failed and why.”

I sprung to action. “That’s simple mate, let me introduce you to Get-SMJob.”

PS C:\Program Files\Simply Migrate> $items = Get-SMJob -SourceMigrationTypes PSTFile -ShowEntries -ItemStatuses Failed, FailedPerm

Let me walk you through the cmdlet above. I’ve asked Get-SMJob to filter results based on the Job type of PST File Sources. I have also asked it to only show me items that have failed, or Perm Failed.

To digest this information, it is a simple matter of using the $items variable we created above. In this case, we want to see the cause of the failures.

PS C:\Program Files\Simply Migrate> $items.Entries.StatusMessage

Boom, Question solved in 2 easy lines.

A bit of explaining

So, let’s consider for a second just how powerful the above cmdlet is. I have in a single line, give us the ability to produce a management report. I can add standard Powershell criteria around the results and come away with exactly what I need. For example :

PS C:\Program Files\Simply Migrate> $items.Entries.StatusMessage | where {$_.DateCreated -gt '01/01/2016'}

It would be returned results newer than the date provided. Now I can get statistics like throughput, data volumes, etc for a specific date range. All in the same line as I used above. That’s pretty powerful stuff.

The above example show’s just one use case, but I wanted to show the power of a simple cmdlet and how it empowers you to get insights into your migration quickly and simply with no fuss. Jump on over to the technical support article at Get-SMJob for more information.

No Comments

Be the first to start a conversation

Leave a Comment