"C:\Program Files\Zabbix\zabbix_agentd86.exe" --config "C:\Program Files\Zabbix\zabbix_agentd.conf" --install net start "Zabbix Agent"
"C:\Program Files\Zabbix\zabbix_agentd64.exe" --config "C:\Program Files\Zabbix\zabbix_agentd.conf" --install net start "Zabbix Agent"
<?xml version="1.0" encoding="UTF-8"?> <zabbix_export> <version>2.0</version> <date>2012-11-21T09:18:17Z</date> <groups> <group> <name>Default</name> </group> </groups> <hosts>
<proxy/> <status>0</status> <ipmi_authtype>-1</ipmi_authtype> <ipmi_privilege>2</ipmi_privilege> <ipmi_username/> <ipmi_password/> <templates> <template> <name>Template OS Windows</name> </template> </templates> <groups> <group> <name>Default</name> </group> </groups> <interfaces> <interface> <default>1</default> <type>1</type> <useip>0</useip> <ip/>
<port>10050</port> <interface_ref>if1</interface_ref> </interface> </interfaces> <applications/> <items/> <discovery_rules/> <macros/> <inventory/> </host>
Remove-Item .\out.txt # Remove-Item .\out.xml # copy .\Source1.txt .\out.txt # xml # Import-CSV ".\computers.csv" -header("ComputerName") | ForEach { $ComputerName = $_.ComputerName #- , :) New-Item "\\$ComputerName\c$\Program Files\Zabbix" -Type Directory $path = "\\$ComputerName\c$\Program Files\Zabbix" Copy-Item \\server\share\DeployZabbix\* $path $bit = Get-WmiObject Win32_Processor -computername $ComputerName | where {$_.DeviceID -eq "CPU0"} | Select AddressWidth if ($bit -like '*64*') { .\psexec.exe \\$ComputerName "C:\\Program Files\Zabbix\Install64.bat" -h } else { .\psexec.exe \\$ComputerName "C:\\Program Files\Zabbix\Install86.bat" -h } Add-Content .\out.txt ('<host>') Add-Content .\out.txt ('<host>' + $_.ComputerName + '</host>') Add-Content .\out.txt ('<name>' + $_.ComputerName + '</name>') gc Source2.txt | Out-File .\out.txt -Append -Encoding default Add-Content .\out.txt ('<dns>' + $_.ComputerName + '</dns>') gc Source3.txt | Out-File .\out.txt -Append -Encoding default } Add-Content .\out.txt ('</hosts>') Add-Content .\out.txt ('</zabbix_export>') Rename-Item .\out.txt "out.xml"
Source: https://habr.com/ru/post/168185/
All Articles