Powershell Automated Installation Zabbix Agent

Source: Internet
Author: User

############################################ #Author: lixiaosong#[email protected] #For: Auto install  zabbix-agent#version:1.0############################################# #wget    http:// Www.zabbix.com/downloads/2.4.1/zabbix_agents_2.4.1.win.zip -outfile c:\zabbix_agent.zipfunction  unzip-file () {    param ([string] $ZipFile, [string] $TargetFolder)       #确保目标文件夹必须存在     if (!) ( test-path  $TargetFolder))     {        mkdir   $TargetFolder     }     $shellApp  = new-object - comobject shell.application     $files  =  $shellApp. NameSpace ($ZipFile). Items ()      $shellApp. NameSpace ($TargetFolder). CopyHere ($files)} #将安装文件解压Unzip-file -zipfile c:\zabbix_agent.zip -targetfolder c:\zabbix_ agent# Deleting the default profile Rm c:\zabbix_agent\conf\zabbix_agentd.win.conf$hostname=hostnameadd-content -value  "LogFile=C:\zabbix_agent\ Zabbix.log " C:\zabbix_agent\conf\zabbix_agentd.win.confAdd-Content -value  " server=1.1.1.1 " C:\zabbix_agent\conf\zabbix_agentd.win.confAdd-Content -value " Hostname= $hostname " c:\ zabbix_agent\conf\zabbix_agentd.win.confadd-content -value   "ServerActive=1.1.1.1"  C:\ zabbix_agent\conf\zabbix_agentd.win.conf  #判断系统类型 $sysinfo = (systeminfo.exe) [+] $sysinfonew = $sysinfo. Replace ("System type:         ", "") if  ($sysinfonew  -like  "X64-BASED PC"  ) {c:\zabbix_agent\bin\win64\zabbix_agentd.exe -c c:\zabbix_agent\conf\ Zabbix_agentd.win.conf -i}else {c:\zabbix_agent\bin\win32\zabbix_agentd.exe -c c:\zabbix_ agent\conf\zabbix_agentd.win.conf -i}start-service  "Zabbix agent" Rm C:\zabbix_agent.zip



This article is from the "operation and maintenance of life" blog, please make sure to keep this source http://lixiaosong.blog.51cto.com/705126/1663595

Powershell Automated Installation Zabbix Agent

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.