sysadmin:installare_snmp_da_powershell
Differences
This shows you the differences between two versions of the page.
sysadmin:installare_snmp_da_powershell [11/06/2017 07:09] – external edit 127.0.0.1 | sysadmin:installare_snmp_da_powershell [20/12/2021 09:26] (current) – lrosa | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Installare SNMP da PowerShell ====== | ||
+ | |||
+ | L' | ||
+ | <code powershell> | ||
+ | Import-Module ServerManager | ||
+ | Add-WindowsFeature SNMP-Services | ||
+ | </ | ||
+ | |||
+ | Questo è uno script più complesso: | ||
+ | <code powershell> | ||
+ | #Powershell Script To Install SNMP Services (SNMP Service, SNMP WMI Provider) | ||
+ | #Variables | ||
+ | $pmanagers = "ADD HOST SNMP RECEIVER" | ||
+ | $commstring = "ADD SNMP VALUENAME" | ||
+ | #Import ServerManger Module | ||
+ | Import-Module ServerManager | ||
+ | #Check If SNMP Services Are Already Installed | ||
+ | $check = Get-WindowsFeature | Where-Object {$_.Name -eq " | ||
+ | If ($check.Installed -ne " | ||
+ | # | ||
+ | Add-WindowsFeature SNMP-Services | Out-Null | ||
+ | } | ||
+ | ##Verify Windows Servcies Are Enabled | ||
+ | If ($check.Installed -eq " | ||
+ | #Set SNMP Permitted Manager(s) ** WARNING : This will overwrite current settings ** | ||
+ | reg add " | ||
+ | #Used as counter for incremting permitted managers | ||
+ | $i = 2 | ||
+ | Foreach ($manager in $pmanagers) { | ||
+ | reg add " | ||
+ | $i++ | ||
+ | } | ||
+ | #Set SNMP Community String(s)- *Read Only* | ||
+ | Foreach ( $string in $commstring) { | ||
+ | reg add " | ||
+ | } | ||
+ | } | ||
+ | Else | ||
+ | { | ||
+ | Write-Host " | ||
+ | } | ||
+ | </ | ||
+ | |||