Commit d3edc1d6 by Rinat K. Nugaev

Update has some bugfixes

parent 719684c9
...@@ -17,12 +17,12 @@ If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent ...@@ -17,12 +17,12 @@ If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdent
{ {
Write-Warning "You do not have Administrator rights to run this script!`nPlease re-run this script as an Administrator!" Write-Warning "You do not have Admin rights to run this script!`nPlease re-run this script with Admin rights!"
Break Break
} }
#Importing module BitsTransfer #Importing module BitsTransfer for downloading zip archive with zabbix agent
Try Try
{ {
Import-Module BitsTransfer -ErrorAction stop Import-Module BitsTransfer -ErrorAction stop
...@@ -45,8 +45,8 @@ $monserverip = (Test-Connection -ComputerName monitoring.nugaev.net -count 1).IP ...@@ -45,8 +45,8 @@ $monserverip = (Test-Connection -ComputerName monitoring.nugaev.net -count 1).IP
Try Try
{ {
$url = "https://support.nugaev.net/files/distrib/zabbix_agent.zip" $url = "https://support.nugaev.net/files/distrib/zabbix_agent.zip"
$output = $env:TEMP $temparchive = $env:TEMP
Start-BitsTransfer -Source $url -Destination $output -ErrorAction stop Start-BitsTransfer -Source $url -Destination $temparchive -ErrorAction stop
} }
Catch Catch
{ {
...@@ -65,8 +65,8 @@ function Unzip ...@@ -65,8 +65,8 @@ function Unzip
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath)
} }
Unzip $output\zabbix_agent.zip $PathZabbix Unzip $temparchive\zabbix_agent.zip $PathZabbix
Remove-Item -Force $temparchive\zabbix_agent.zip
#Getting computer hostname for config file #Getting computer hostname for config file
$HostnameFull ="$env:computername.$env:userdnsdomain" $HostnameFull ="$env:computername.$env:userdnsdomain"
#Removing dot from end of the hostname (this behavior possible if computer is not domain joined) #Removing dot from end of the hostname (this behavior possible if computer is not domain joined)
...@@ -96,5 +96,3 @@ New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profi ...@@ -96,5 +96,3 @@ New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profi
New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction OutBound -Protocol TCP -LocalPort 10051 New-NetFirewallRule -DisplayName "ZabbixOUT" -RemoteAddress $monserverip -Profile Any -Action Allow -Direction OutBound -Protocol TCP -LocalPort 10051
Write-host "Firewall rule for Monitoring Server added..." Write-host "Firewall rule for Monitoring Server added..."
Write-host "Installation completed!" Write-host "Installation completed!"
\ No newline at end of file
Write-host "Dont worry.. some red output because cmd command run in powershell )))"
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment