romainsi / zabbix-VEEAM_B-R

52 stars 40 forks source link

ps script fails on Windows 7 #49

Open sergeileshchinsky opened 4 years ago

sergeileshchinsky commented 4 years ago

Any way to make it work on Windows 7 ?

Running into:

c:\Program` Files\Zabbix Agent>powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Zabbix Agent\scripts \zabbix_vbr_job.ps1" DiscoveryRepo DiscoveryRepo The term 'Get-CimInstance' 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 C:\Program Files\Zabbix Agent\scripts\zabbix_vbr_job.ps1:315 char:27

The term 'ConvertTo-Json' 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 C:\Program Files\Zabbix Agent\scripts\zabbix_vbr_job.ps1:278 char:38

get-modules for powershell returns empty list can I just add required modules?

Thanks

sergeileshchinsky commented 4 years ago

upgraded .NET upgraded WMI upgraded powershell to v6. enabled winrm

script returns data now

sergeileshchinsky commented 4 years ago

Still no go :( powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Zabbix Agent\scripts\zabbix_vbr_job.ps1" ExportXml

does populate the xml files but zabbix complains they are not valid json (?) -> can't be processed:

discovery error: Invalid discovery rule value: cannot parse as a valid JSON object: invalid object format, expected opening character '{' or '[' at: 'DiscoveryBackupVmsByJobs {"data":[{"{#JOBVMNAME}":"server1.my.org","{#JOBNAME}":"Medium priority (Weekly)"}, ...

moreover, after next zabbix iteration all xml are rewritten with <Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04" />

example from manually populated backupsyncvmbyjob.xml:

`

Selected.Veeam.Backup.Core.CObjectInJob System.Management.Automation.PSCustomObject System.Object Medium priority (Weekly) server1.my.org ...` Any clue? Thanks
bontiv commented 3 years ago

For Windows 7, you must install Windows Management Framework 3.0. You can download it here : https://www.microsoft.com/en-us/download/details.aspx?id=34595