PowerShell script exchange
karim
Enthusiast
Posts: 51 Liked: 5 times
Joined: Oct 17, 2018 9:01 am
Contact:
Post
by karim » Oct 30, 2018 2:12 pm
this post
hi,
i'm unable to find how to set pre-freeze and post-thaw scripts with powershell.
i tried this :
Code: Select all
$object = Get-VBRJob -Name "b_infras_3h" | Get-VBRJobObject -Name "DELLSTORMAN"
$vssobjoptions.VssSnapshotOptions.Enabled = $True
$vssobjoptions = Get-VBRJob -Name "b_infras_3h" |Get-VBRJobObject -Name "DELLSTORMAN" | Get-VBRJobObjectVssOptions
$vssobjoptions.GuestScriptsOptions.ScriptingMode = "FailJobOnError"
$vssobjoptions.GuestScriptsOptions.WinScriptFiles.PreScriptFilePath = "L:\Scripts\Windows\Backup_mssql.cmd"
$vssobjoptions.GuestScriptsOptions.WinScriptFiles.PostScriptFilePath = "L:\Scripts\Windows\Backup_databases.cmd"
Set-VBRJobObjectVssOptions -Options $vssobjoptions -Object $object
but after apply, i only find the script processing mode set to "Require successful script execution" but not script are set.
what i'm doing wrong?
thank you.
Vek17
Service Provider
Posts: 49 Liked: 15 times
Joined: May 29, 2018 8:42 pm
Contact:
Post
by Vek17 » Oct 31, 2018 1:29 pm
2 people like this post
You are going to have to set it via a new WinScriptFiles object
Code: Select all
$object = Get-VBRJob -Name "b_infras_3h" | Get-VBRJobObject -Name "DELLSTORMAN"
$vssobjoptions.VssSnapshotOptions.Enabled = $True
$vssobjoptions = Get-VBRJob -Name "b_infras_3h" |Get-VBRJobObject -Name "DELLSTORMAN" | Get-VBRJobObjectVssOptions
$vssobjoptions.GuestScriptsOptions.ScriptingMode = "FailJobOnError"
$vssobjoptions.GuestScriptsOptions.WinScriptFiles = [Veeam.Backup.Model.CScriptFiles]::new( "L:\Scripts\Windows\Backup_mssql.cmd", "L:\Scripts\Windows\Backup_databases.cmd")
Set-VBRJobObjectVssOptions -Options $vssobjoptions -Object $object
karim
Enthusiast
Posts: 51 Liked: 5 times
Joined: Oct 17, 2018 9:01 am
Contact:
Post
by karim » Nov 15, 2018 9:29 am
this post
hello
it works
thank you!
dbr
Expert
Posts: 121 Liked: 16 times
Joined: Apr 06, 2017 9:48 am
Full Name: Daniel Brase
Contact:
Post
by dbr » May 20, 2019 2:09 pm
this post
Hi all,
I had the same problem when settings guestprocessing scripts via powershell. Unfortunately, it seems that the method "new" isn't availble to the WinScriptFiles object anymore. I'm running 9.5 U4 and was able to get that working with something like this:
Code: Select all
$scriptsobject=[Veeam.Backup.Model.CScriptFiles]::CreateDefault()
$scriptsobject.PreScriptFilePath="C:\Scripts\guestprocessing\db2\pre-freeze.cmd"
$scriptsobject.PostScriptFilePath="C:\Scripts\guestprocessing\db2\post-thaw.cmd"
$jobobjectvssoptions = Get-VBRJobObjectVssOptions -objectinjob <jobobject>
$jobobjectvssoptions.guestscriptsoptions.ScriptingMode="FailJobOnError"
$jobobjectvssoptions.guestscriptsoptions.winscriptfiles=$scriptsobject
Set-VBRJobObjectVssOptions -object $jobobject -options $jobobjectvssoptions
Daniel
Vek17
Service Provider
Posts: 49 Liked: 15 times
Joined: May 29, 2018 8:42 pm
Contact:
Post
by Vek17 » May 20, 2019 7:28 pm
this post
Glad that you got it working, but as far as I can tell you can still build a new [Veeam.Backup.Model.CScriptFiles] the same way as U3 (And I still am using it currently).
Users browsing this forum: Bing [Bot] and 7 guests