forked from tueit_GmbH/boxstarter
„tiNGrundpaketServer.txt“ ändern
This commit is contained in:
@ -2,37 +2,17 @@
|
||||
#TODO: Defaultprograms for Datatypes, Install all Updates (not only critical)
|
||||
|
||||
#----------------Setting Variables------------------------
|
||||
#Set these Variables to newest Version
|
||||
$dZabbixAgentDownloadUrlMsi = "https://www.zabbix.com/downloads/4.4.1/zabbix_agent-4.4.1-win-amd64-openssl.msi"
|
||||
$dZabbixWindowsUpdatesVBSUrl = "https://git.tueit.de/tueit_GmbH/zabbix_client_configuration/raw/commit/cbb8ed1c397202e44fc39173e88efc8fff72e447/windowsserver2019/winupdates.vbs"
|
||||
|
||||
#Other Variables
|
||||
$dHostname = Read-Host 'Input desired Hostname (Default: Keep current hostname)'
|
||||
if($dHostname -eq ""){$dHostname = [Net.Dns]::GetHostName()}
|
||||
$dInstallZabbix = ""
|
||||
$dZabbixServer = ""
|
||||
$dZabbixPSK = ""
|
||||
$dZabbixHostname = ""
|
||||
$dInstallZabbix = Read-Host 'Install and configure Zabbix Agent (yes/no)? (Default: yes)'
|
||||
if(($dInstallZabbix -eq "yes") -or ($dInstallZabbix -eq "")){`
|
||||
$dZabbixServer = Read-Host 'Input Zabbix Server or Proxy IP (Default: IP of DefaultGateway)'
|
||||
if($dZabbixServer -eq ""){$dZabbixServer = Get-NetRoute -DestinationPrefix "0.0.0.0/0" | Select-Object -ExpandProperty "NextHop"}
|
||||
$dZabbixPSK = Read-Host 'Input Zabbix PSK (Default: NotSet)'
|
||||
if($dZabbixPSK -eq ""){$dZabbixPSK = "NotSet"}
|
||||
$dZabbixHostname = Read-Host 'Input Zabbix Hostname as defined in Zabbix Server (Default: NotSet)'
|
||||
if($dZabbixHostname -eq ""){$dZabbixHostname = "NotSet"}
|
||||
}
|
||||
|
||||
#---------------Configure Chocolatey and Environment-------------------------------
|
||||
choco features enable -n=allowGlobalConfirmation
|
||||
choco feature enable -n=allowEmptyChecksums
|
||||
New-Item -ErrorAction Ignore -Path "C:\" -Name "temp" -ItemType "directory"`
|
||||
|
||||
#--------------Install Zabbix Agent (if wanted)------------------------------
|
||||
if(($dInstallZabbix -eq "yes") -or ($dInstallZabbix -eq "")){
|
||||
wget -O $dZabbixAgentDownloadUrlMsi "C:\temp\zabbix_agent_setup.msi"
|
||||
msiexec /l*v "C:\temp\zabbix_installation_log.txt" /i "C:\temp\zabbix_agent_setup.msi" /norestart /qn SERVER="$dZabbixServer" HOSTNAME="$dZabbixHostname" TLSCONNECT=psk TLSACCEPT=psk TLSPSKIDENTITY="$dHostname" TLSPSKVALUE="$dZabbixPSK" ENABLEREMOTECOMMANDS=1
|
||||
}
|
||||
|
||||
|
||||
#----------------Configure Windows------------------------
|
||||
#Set Hostname
|
||||
@ -94,15 +74,6 @@ choco install windirstat -y --cacheLocation="c:\temp"
|
||||
choco install doublecmd -y --cacheLocation="c:\temp"
|
||||
choco install vim -y --cacheLocation="c:\temp" --params "'/NoDesktopShortcuts'"
|
||||
|
||||
#---------------Zabbix: Windows Update Trapper incl. Aufgabenplanung einrichten-----------------
|
||||
#Wird erst jetzt ausgeführt da die Installation von Zabbix vorher abgeschlossen sein muss
|
||||
if(($dInstallZabbix -eq "yes") -or ($dInstallZabbix -eq "")){
|
||||
Write-Host Create Windows Update windowsupdates.bat file for sending data to Zabbix Trapper:
|
||||
Write-Output "cscript //NoLogo `"C:\Program Files\Zabbix Agent\winupdates.vbs`" $dZabbixHostname | `"C:\Program Files\Zabbix Agent\zabbix_sender.exe`" -z $dZabbixServer -i - -c `"C:\Program Files\Zabbix Agent\zabbix_agentd.conf`"" | Out-File -FilePath "C:\Program Files\Zabbix Agent\winupdates.bat" -Encoding ascii
|
||||
Write-Host Copy VBS-Script for Windows Updates:
|
||||
wget -O "C:\Program Files\Zabbix Agent\winupdates.vbs" $dZabbixWindowsUpdatesVBSUrl
|
||||
Write-Host Create Task for Windows Updates polling to Zabbix:
|
||||
schtasks /create /tn "Zabbix Winupdate Send" /sc MINUTE /mo 30 /tr "C:\Program Files\Zabbix Agent\winupdates.bat" /ru System
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user