romainsi / zabbix-VEEAM_B-R

52 stars 40 forks source link

PS script not work in Windows server 2008 R2 [Windows server 2012 working] #47

Closed aurupong closed 4 years ago

aurupong commented 4 years ago

PS C:\Windows\system32> powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Zabbix Agent\scripts\z abbix_vbr_job.ps1" ExportXml Unexpected token '.' in expression or statement. At C:\Program Files\Zabbix Agent\scripts\zabbix_vbr_job.ps1:213 char:31

PS C:\Windows\system32>

romainsi commented 4 years ago

Hello, Please change the VeeamStatusReplace function on line 208 to 228 as follows : Delete all carriage returns:

old : function VeeamStatusReplace { [CmdletBinding()] Param ([Parameter(ValueFromPipeline = $true)] $item) $item.replace('Failed', '0'). replace('Warning', '1'). replace('Success', '2'). replace('None', '2'). replace('idle', '3'). replace('InProgress', '5'). replace('Pending', '6'). replace('Pausing', '7'). replace('Postprocessing', '8'). replace('Resuming', '9'). replace('Starting', '10'). replace('Stopped', '11'). replace('Stopping', '12'). replace('WaitingRepository', '13'). replace('WaitingTape', '13'). replace('Working', '13') }

new :

# Replace Function for Veeam Correlation function VeeamStatusReplace { [CmdletBinding()] Param ([Parameter(ValueFromPipeline = $true)] $item) $item.replace('Failed', '0').replace('Warning', '1').replace('Success', '2').replace('None', '2').replace('idle', '3').replace('InProgress', '5').replace('Pending', '6').replace('Pausing', '7').replace('Postprocessing', '8').replace('Resuming', '9').replace('Starting', '10').replace('Stopped', '11').replace('Stopping', '12').replace('WaitingRepository', '13').replace('WaitingTape', '13').replace('Working', '13') }