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 »

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: 17777
Liked: 1626 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 » 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 »

This does exactly what I need, thanks a lot!

veremin
Product Manager
Posts: 17777
Liked: 1626 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 »

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 9 guests