-
- Novice
- Posts: 4
- Liked: never
- Joined: Jul 25, 2023 11:31 am
- Contact:
pre-freeze/post-thaw scripts for backup jobs
hi,
i was wondering if there any way to run a powershell script that shows you your VMware backup jobs and the associated pre-frezee and post-thaws scipt, under which path they are stored.
For windows vm and for linux vm
If a script is defined at all. ?
Thank u
Ercan
i was wondering if there any way to run a powershell script that shows you your VMware backup jobs and the associated pre-frezee and post-thaws scipt, under which path they are stored.
For windows vm and for linux vm
If a script is defined at all. ?
Thank u
Ercan
-
- Veeam Software
- Posts: 2346
- Liked: 556 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: pre-freeze/post-thaw scripts for backup jobs
Hi @bravo, sure, this is part of the returned objects from Get-VBRJobObjectVSSOptions. Try a workflow like this to test, and build a script around it:
$Job = Get-VBRJob -name "some job" #pick some job with just one object for testing convenience right now)
$JobObjects = Get-VBRJobObjects -Job $job
$VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
$VSSOpts.GuestScriptsOptions
The last variable and the GuestScriptsOptions is what you need.
The output of that will look something like this for an object with scripts:
PS C:\Users\Administrator> $VSSOpts.GuestScriptsOptions
You can parse on IsAtLeastOneScriptSet to know if you need to check deeper on this object for Winscript or LinScript files. These will return something like this:
Give it a shot in your environment with a test job, then you'll see how it works and you can build something for all your jobs.
$Job = Get-VBRJob -name "some job" #pick some job with just one object for testing convenience right now)
$JobObjects = Get-VBRJobObjects -Job $job
$VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
$VSSOpts.GuestScriptsOptions
The last variable and the GuestScriptsOptions is what you need.
The output of that will look something like this for an object with scripts:
PS C:\Users\Administrator> $VSSOpts.GuestScriptsOptions
Code: Select all
ScriptingMode : FailJobOnError
WinScriptFiles : Veeam.Backup.Model.CScriptFiles
LinScriptFiles : Veeam.Backup.Model.CScriptFiles
JobLinScriptFiles : Veeam.Backup.Model.CScriptFiles
JobMacScriptFiles : Veeam.Backup.Model.CScriptFiles
IsAtLeastOneScriptSet : True
CredsId : 00000000-0000-0000-0000-000000000000
Code: Select all
PS C:\Users\Administrator> $VSSOpts.GuestScriptsOptions.WinScriptFiles
PreScriptFilePath PostScriptFilePath IsAtLeastOneScriptSet
----------------- ------------------ ---------------------
"C:\scripts and a space\PID script.ps1" True
David Domask | Product Management: Principal Analyst
-
- Novice
- Posts: 4
- Liked: never
- Joined: Jul 25, 2023 11:31 am
- Contact:
Re: pre-freeze/post-thaw scripts for backup jobs
hi davin,
thanks for your feedback.
i have just created a new backup job "test1" where a windows vm is backed up. under guest processing -> processing settings i have attached the (test) pre & post script.
when i want to run your 4 line code with Get-VBRJob -name "test1", unfortunately i don't get the infos like from your post, but an error message.
thanks for your feedback.
i have just created a new backup job "test1" where a windows vm is backed up. under guest processing -> processing settings i have attached the (test) pre & post script.
when i want to run your 4 line code with Get-VBRJob -name "test1", unfortunately i don't get the infos like from your post, but an error message.
-
- Veeam Software
- Posts: 2346
- Liked: 556 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: pre-freeze/post-thaw scripts for backup jobs
Hi @bravo, can you post the full shell text? Include the entire error please.
David Domask | Product Management: Principal Analyst
-
- Novice
- Posts: 4
- Liked: never
- Joined: Jul 25, 2023 11:31 am
- Contact:
Re: pre-freeze/post-thaw scripts for backup jobs
hi David!
sorry for the late feedback.
there u go
PS C:\Users\Administrator> $Job = Get-VBRJob -name "test1" #pick some job with just one object for testing convenience right now)
>> $JobObjects = Get-VBRJobObjects -Job $job
>> $VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
>> $VSSOpts.GuestScriptsOptions
Get-VBRJobObjects : The term 'Get-VBRJobObjects' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:2 char:15
+ $JobObjects = Get-VBRJobObjects -Job $job
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRJobObjects:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-VBRJobObjectVssOptions : Cannot validate argument on parameter 'ObjectInJob'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At line:3 char:52
+ $VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
+ ~~
+ CategoryInfo : InvalidData: (:) [Get-VBRJobObjectVssOptions], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Cmdlets.GetVBRJobObjectVssOptio
ns
sorry for the late feedback.
there u go
PS C:\Users\Administrator> $Job = Get-VBRJob -name "test1" #pick some job with just one object for testing convenience right now)
>> $JobObjects = Get-VBRJobObjects -Job $job
>> $VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
>> $VSSOpts.GuestScriptsOptions
Get-VBRJobObjects : The term 'Get-VBRJobObjects' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:2 char:15
+ $JobObjects = Get-VBRJobObjects -Job $job
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VBRJobObjects:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Get-VBRJobObjectVssOptions : Cannot validate argument on parameter 'ObjectInJob'. The argument is null or empty.
Provide an argument that is not null or empty, and then try the command again.
At line:3 char:52
+ $VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
+ ~~
+ CategoryInfo : InvalidData: (:) [Get-VBRJobObjectVssOptions], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Cmdlets.GetVBRJobObjectVssOptio
ns
-
- Veeam Software
- Posts: 2346
- Liked: 556 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: pre-freeze/post-thaw scripts for backup jobs
Ah! I made a typo
So sorry
$JobObjects = Get-VBRJobObject -Job $job
It was the S on Get-VBRJobObject: https://helpcenter.veeam.com/docs/backu ... ml?ver=120
Sorry for the typo

So sorry

$JobObjects = Get-VBRJobObject -Job $job
It was the S on Get-VBRJobObject: https://helpcenter.veeam.com/docs/backu ... ml?ver=120
Sorry for the typo

David Domask | Product Management: Principal Analyst
-
- Novice
- Posts: 4
- Liked: never
- Joined: Jul 25, 2023 11:31 am
- Contact:
Re: pre-freeze/post-thaw scripts for backup jobs
hey david,
typos can be very tricky haha
I now get this message.
PS C:\Users\Administrator>
Get-VBRJobObjectVssOptions : Cannot validate argument on parameter 'ObjectInJob'. The argument is null or empty. Provide an argument
that is not null or empty, and then try the command again.
At line:3 char:52
+ $VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
+ ~~
+ CategoryInfo : InvalidData: (:) [Get-VBRJobObjectVssOptions], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Cmdlets.GetVBRJobObjectVssOptions
typos can be very tricky haha

I now get this message.
PS C:\Users\Administrator>
Code: Select all
$Job = Get-VBRJob -name "test1" #pick some job with just one object for testing convenience right now)
$JobObjects = Get-VBRJobObject -Job $job
$VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
$VSSOpts.GuestScriptsOptions
that is not null or empty, and then try the command again.
At line:3 char:52
+ $VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
+ ~~
+ CategoryInfo : InvalidData: (:) [Get-VBRJobObjectVssOptions], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Veeam.Backup.PowerShell.Cmdlets.GetVBRJobObjectVssOptions
-
- Veeam Software
- Posts: 2346
- Liked: 556 times
- Joined: Jun 28, 2016 12:12 pm
- Contact:
Re: pre-freeze/post-thaw scripts for backup jobs
Ah, apparently I was needing coffee when I wrote that :/
Originally I had it loop over the $JobObjects list, so that's why -ObjectInJob failed.
$Job = Get-VBRJob -name "test1" #pick some job with just one object for testing convenience right now)
$JobObjects = Get-VBRJobObject -Job $job
$VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $JobObjects
$VSSOpts.GuestScriptsOptions
Try that.
If it doesn't go change it to:
$Job = Get-VBRJob -name "test1" #pick some job with just one object for testing convenience right now)
$JobObjects = Get-VBRJobObject -Job $job
Foreach($j in $JobObjects){
$VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
$VSSOpts.GuestScriptsOptions
}
Originally I had it loop over the $JobObjects list, so that's why -ObjectInJob failed.
$Job = Get-VBRJob -name "test1" #pick some job with just one object for testing convenience right now)
$JobObjects = Get-VBRJobObject -Job $job
$VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $JobObjects
$VSSOpts.GuestScriptsOptions
Try that.
If it doesn't go change it to:
$Job = Get-VBRJob -name "test1" #pick some job with just one object for testing convenience right now)
$JobObjects = Get-VBRJobObject -Job $job
Foreach($j in $JobObjects){
$VSSOpts = Get-VBRJobObjectVSSOptions -ObjectInJob $j
$VSSOpts.GuestScriptsOptions
}
David Domask | Product Management: Principal Analyst
Who is online
Users browsing this forum: No registered users and 22 guests