Change background image
LOVE quotion

Bắt đầu từ 4.53' thứ Hai ngày 17/10/2011


You are not connected. Please login or register

Xem chủ đề cũ hơn Xem chủ đề mới hơn Go down  Thông điệp [Trang 1 trong tổng số 1 trang]

DuyHung
DuyHung Xuất sắc

Cấp bậc: Xuất sắc

Giới tính : Nam

Bài viết : 1246

Danh vọng : 2256

Uy tín : 32

Install the latest version of WINDOWS 10 LTSC Enterprise Edition, found that the lack of SNMP function, through the control panel - program - open and close the WINDOW function can not find the SIMPLE NETWORK MANAGEMENT PROTOCOL option, as shown below:

Cài đặt SNMP cho Windows 10 LTSC 2019 Snmp0110

Through various searches, finally find a solution, you can add SNMP function through the powershell command line

1. Run the command: Get the full name of the SNMP function:

Get-WindowsCapability -Online -Name "SNMP*"

Cài đặt SNMP cho Windows 10 LTSC 2019 Snmp0210

2. Run the following command to install:

Add-WindowsCapability -Online -Name "SNMP.Client~~~~0.0.1.0"

Cài đặt SNMP cho Windows 10 LTSC 2019 Snmp0310

Check again to find that the SNMP display is installed:

Cài đặt SNMP cho Windows 10 LTSC 2019 Snmp0410

Source: https://www.shusite.com/server/79933.html
      
DuyHung
DuyHung Xuất sắc

Cấp bậc: Xuất sắc

Giới tính : Nam

Bài viết : 1246

Danh vọng : 2256

Uy tín : 32

Here is one. All you need to do is change the variables accordingly. In your case:

$pmanagers = '10.54.130.12'

$CommString = 'XYZ'

Code:
Note:  This does not work on Server 2012 R2 servers.  The services names have changed and I haven't taken the time to modify my script yet.

####################################
# Script Location: T:\scripts\InstallSNMP.ps1
# Description: Powershell script to install and configure SNMP Services (SNMP Service, SNMP WMI Provider)
# Last update: 2014/02/14
####################################

#Variables :)
$pmanagers = @("snmpserver1.company.com","snmpserver2.company.com") # ADD YOUR MANAGER(s) in format @("manager1","manager2")
$CommString = @("Ninja") # ADD YOUR COMM STRING(s) in format @("Community1","Community2")

#Import ServerManger Module
Import-Module ServerManager

#Check if SNMP-Service is already installed
$check = Get-WindowsFeature -Name SNMP-Service

If ($check.Installed -ne "True") {
#Install/Enable SNMP-Service
Write-Host "SNMP Service Installing..."
Get-WindowsFeature -name SNMP* | Add-WindowsFeature -IncludeManagementTools | Out-Null
}

$check = Get-WindowsFeature -Name SNMP-Service

##Verify Windows Services Are Enabled
If ($check.Installed -eq "True"){
Write-Host "Configuring SNMP Services..."
#Set SNMP Permitted Manager(s) ** WARNING : This will over write current settings **
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v 1 /t REG_SZ /d localhost /f | Out-Null

#Set SNMP Traps and SNMP Community String(s) - *Read Only*
Foreach ($String in $CommString){
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /f | Out-Null
# Set the Default value to be null
reg delete ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /ve /f | Out-Null
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities" /v $String /t REG_DWORD /d 4 /f | Out-Null
$i = 2
Foreach ($Manager in $PManagers){
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v $i /t REG_SZ /d $manager /f | Out-Null
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /v $i /t REG_SZ /d $manager /f | Out-Null
$i++
}
}
}
Else {
Write-Host "Error: SNMP Services Not Installed"
}
Source: http://community.whatsupgold.com/library/powershellscripts/installandconfiguresnmpwithpowershell

Update; Just ran the above on my 2012 Dev machine, with changed variables as described and it gives the desired output.


Edited by Jesper Arnecke Wednesday, December 10, 2014 7:20 AM
Marked as answer by k Ashwini Wednesday, December 10, 2014 10:28 AM
Wednesday, December 10, 2014 6:59 AM
Reply|Quote
Avatar of Jesper Arnecke
Jesper ArneckeIndependent consultant15,676 Points
All replies
Question
Sign in to vote
0
Sign in to vote
You can add configuration to the registry

Take a look at SNMP registry reference for more info.

Remember to restart snmp services after changing the registry

Gleb.

Tuesday, December 9, 2014 9:54 AM
Reply|Quote
Avatar of Gleb F.NG
Gleb F.NGBlinq AS22,402 Points
 
Question
Sign in to vote
0
Sign in to vote
HI Gleb,

Could you let me know what exactly need to be done in the registry specially for 2012 server OS..?I'm really new to powershell.

Also is there anyother way like commands to set string and ip than meddling the registry?

Appreciate the help in advance..!!

Thanks,

Ashwini

Ashwini

Tuesday, December 9, 2014 10:00 AM
Reply|Quote
Avatar of k Ashwini
k Ashwini25 Points
 
Question
Sign in to vote
0
Sign in to vote
Hiya,

You just need to create the registry keys using powershell.
Two examples would be:

Exact SNMP registry specific settings
http://winadminnotes.wordpress.com/2011/07/28/how-to-install-snmp-remotely/

Example of Powershell function to create registry entries using new-ItemProperty
function Disable-LoopbackCheck {
 $path = 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa\'
 $name = 'DisableLoopbackCheck'
 $propertyType = 'DWord'
 $value = '00000001'

 try {
  New-ItemProperty -Path $path -Name $name -PropertyType $propertyType -Value $value
 }
 catch {
  Set-ItemProperty -Path $path -Name $name -Value $value -PassThru
 }
}


Tuesday, December 9, 2014 11:00 AM
Reply|Quote
Avatar of Jesper Arnecke
Jesper ArneckeIndependent consultant15,676 Points
 
Question
Sign in to vote
0
Sign in to vote
HI Jesper ,

I dont need to run the script remotely..

Also sorry I didnt get the example function which you mentioned above.

How can I add the community string and snmp server Ip with it..Where do i have to incorporate this function in my script?

All I want is, to know what  code to add so that I can configure  the highlighted things in the image t after installation through scrip

f

Ashwini


Edited by k Ashwini Wednesday, December 10, 2014 6:36 AM
Wednesday, December 10, 2014 6:19 AM
Reply|Quote
Avatar of k Ashwini
k Ashwini25 Points
 
Question
Sign in to vote
1
Sign in to vote
Here is one. All you need to do is change the variables accordingly. In your case:

$pmanagers = '10.54.130.12'

$CommString = 'XYZ'


Note:  This does not work on Server 2012 R2 servers.  The services names have changed and I haven't taken the time to modify my script yet.

####################################
# Script Location: T:\scripts\InstallSNMP.ps1
# Description: Powershell script to install and configure SNMP Services (SNMP Service, SNMP WMI Provider)
# Last update: 2014/02/14
####################################

#Variables :)
$pmanagers = @("snmpserver1.company.com","snmpserver2.company.com") # ADD YOUR MANAGER(s) in format @("manager1","manager2")
$CommString = @("Ninja") # ADD YOUR COMM STRING(s) in format @("Community1","Community2")

#Import ServerManger Module
Import-Module ServerManager

#Check if SNMP-Service is already installed
$check = Get-WindowsFeature -Name SNMP-Service

If ($check.Installed -ne "True") {
#Install/Enable SNMP-Service
Write-Host "SNMP Service Installing..."
Get-WindowsFeature -name SNMP* | Add-WindowsFeature -IncludeManagementTools | Out-Null
}

$check = Get-WindowsFeature -Name SNMP-Service

##Verify Windows Services Are Enabled
If ($check.Installed -eq "True"){
Write-Host "Configuring SNMP Services..."
#Set SNMP Permitted Manager(s) ** WARNING : This will over write current settings **
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v 1 /t REG_SZ /d localhost /f | Out-Null

#Set SNMP Traps and SNMP Community String(s) - *Read Only*
Foreach ($String in $CommString){
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /f | Out-Null
# Set the Default value to be null
reg delete ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /ve /f | Out-Null
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities" /v $String /t REG_DWORD /d 4 /f | Out-Null
$i = 2
Foreach ($Manager in $PManagers){
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers" /v $i /t REG_SZ /d $manager /f | Out-Null
reg add ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\TrapConfiguration\" + $String) /v $i /t REG_SZ /d $manager /f | Out-Null
$i++
}
}
}
Else {
Write-Host "Error: SNMP Services Not Installed"
}

Source: http://community.whatsupgold.com/library/powershellscripts/installandconfiguresnmpwithpowershell

Update; Just ran the above on my 2012 Dev machine, with changed variables as described and it gives the desired output.

Cài đặt SNMP cho Windows 10 LTSC 2019 577001
      

Xem chủ đề cũ hơn Xem chủ đề mới hơn Về Đầu Trang  Thông điệp [Trang 1 trong tổng số 1 trang]

Quyền hạn của bạn

Bạn không có quyền trả lời bài viết
free counters



  • Đoàn Ngọc Khánh

    mobile phone 098 376 5575


    Đỗ Quang Thảo

    mobile phone 090 301 9666


    Nguyễn Văn Của

    mobile phone 090 372 1401


    IP address signature
    Free forum | ©phpBB | Free forum support | Liên hệ | Báo cáo lạm dụng | Thảo luận mới nhất