PowerShell script exchange
Post Reply
Sand
Influencer
Posts: 24
Liked: never
Joined: Jul 06, 2017 6:07 am
Contact:

Get all jobs with pre- and post-freeze scripts

Post by Sand » Jul 06, 2017 6:18 am

I try to get all jobs that use guest processing pre- and post scripts. I've bin digging the powershell documentation and examples but was only able to get all VSS Enabled jobs so far.

Is it possible to get this information via powershell? I've tried Get-VBRJobObject and get-VBRJobVSSOptions but couldn't find this info in there.

Thanks in advance!

veremin
Product Manager
Posts: 17000
Liked: 1455 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get all jobs with pre- and post-freeze scripts

Post by veremin » Jul 06, 2017 12:40 pm 1 person likes this post

I believe this one-liner is something you're after:

Code: Select all

Get-VBRJob | Where {$_.GetObjectsInJob().VssOptions.GuestScriptsOptions.IsAtLeastOneScriptSet -eq $True -and $_.GetObjectsInJob().VssOptions.GuestScriptsOptions.ScriptingMode -ne "Disabled"} | select name 

Sand
Influencer
Posts: 24
Liked: never
Joined: Jul 06, 2017 6:07 am
Contact:

Re: Get all jobs with pre- and post-freeze scripts

Post by Sand » Jul 06, 2017 12:51 pm

This does exactly what I need, thanks a lot!

veremin
Product Manager
Posts: 17000
Liked: 1455 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Get all jobs with pre- and post-freeze scripts

Post by veremin » Jul 06, 2017 2:21 pm

You're welcome. You can get job object VSS settings, using the following approach:

Code: Select all

$Job = Get-VBRJob -name "Name of your Job"
$JobObject = Get-VBRJobObject -Job $Job -name "Name of job object"
$JobObject.VSSOptions
So, whenever you're in need to find some job object VSS settings, check the VSSOptions first.

Thanks.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests