Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ps script fails on Windows 7 #49

Open
sergeileshchinsky opened this issue Feb 5, 2020 · 3 comments
Open

ps script fails on Windows 7 #49

sergeileshchinsky opened this issue Feb 5, 2020 · 3 comments

Comments

@sergeileshchinsky
Copy link

sergeileshchinsky commented Feb 5, 2020

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

  •     $query = Get-CimInstance <<<<  -Class Repository -ComputerName $env:COMPUTERNAME -Namespace ROOT\VeeamBS | Se
    

lect-Object @{ N = "REPONAME"; E = { $_.NAME } }
+ CategoryInfo : ObjectNotFound: (Get-CimInstance:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

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

  •     @{ 'data' = $out } | ConvertTo-Json <<<<  -Compress
    
    • CategoryInfo : ObjectNotFound: (ConvertTo-Json:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

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

Thanks

@sergeileshchinsky
Copy link
Author

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

script returns data now

@sergeileshchinsky
Copy link
Author

sergeileshchinsky commented Feb 6, 2020

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:

<Objs Version="1.1.0.1" xmlns="http://schemas.microsoft.com/powershell/2004/04"> <Obj RefId="0"> <TN RefId="0"> <T>Selected.Veeam.Backup.Core.CObjectInJob</T> <T>System.Management.Automation.PSCustomObject</T> <T>System.Object</T> </TN> <MS> <S N="Job">Medium priority (Weekly)</S> <S N="Name">server1.my.org</S> </MS> </Obj> ...

Any clue?

Thanks

@bontiv
Copy link

bontiv commented Oct 28, 2020

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

mtxadmin added a commit to mtxadmin/zabbix-VEEAM_B-R that referenced this issue Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants