Discussions specific to the VMware vSphere hypervisor
Post Reply
oliverL
Enthusiast
Posts: 61
Liked: 7 times
Joined: Nov 11, 2016 8:56 am
Full Name: Oliver
Contact:

powershell-pre and post-scripts

Post by oliverL » Nov 13, 2018 10:21 pm

Hi there!

so - i'm using a pretty... unsupported lab here :-)

6.7 U1 vCenter with ESXi on 6.7 U1.

For one VM i enabled HW-Passtrough to put a GPU and USB-Controller trough it (using this ESXi as a Workstation :P ). Ofcourse i can't snapshot a VM to which i passtrough stuff. Therefore i need to shut it down and afterwards reboot the whole ESXi or else i can't start the workstation VM due to the GPU Passtrough.

So i decided to create two Powershell Scripts and imported the following into my powershell profile under my veeam service account:

Code: Select all

Write-Host "Hello my friend, come in and listen for a while...."
Import-Module VMware.PowerCLI
Connect-VIServer vcsa-01.lab.local
I've also created a VICredentialStoreItem for the veeam service account, so that i don't need to use passwords in scripts.

my pre-job script contains the following:

Code: Select all

Connect-VIServer vcsa-01.lab.local
get-vm ol-workstation | stop-vm -Confirm $false
but the Veeam Job doesn't seem to execute the script because it is staying in "Running Pre-Job Scripts" (15 Minutes seems to be the timeout... - can you change the timeout-values for testing?)

the same with my reboot skript.

Is there something missing or should i load the whole stuff in each script and not in the powershell profile variable?

Andreas Neufert
Veeam Software
Posts: 3828
Liked: 687 times
Joined: May 04, 2011 8:36 am
Full Name: Andreas Neufert
Location: Germany
Contact:

Re: powershell-pre and post-scripts

Post by Andreas Neufert » Nov 14, 2018 8:07 am

Hi Oliver, thanks for the request.
Please find the registry values that you have to implement on the Backup Server. Afterwards please restart the "Veeam Backup Service".


HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication\

PreJobScriptTimeoutSec
Type: REG_DWORD
Default value: 15 * 60

PostJobScriptTimeoutSec
Type: REG_DWORD
Default value: 15 * 60

Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests