Archive

Articles taggués ‘SNMP’

Configurer la communauté SNMP.

Permet de configurer le service SNMP d’un serveur distant.
Ce script configure la communauté et les hosts autorisés.

?View Code POWERSHELL
$server = Read-Host "Please enter the server name"
		$MachineName = $server
		$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $MachineName)
		$regconf = $reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters",$true)
		$regconf.SetValue('EnableAuthenticationTraps','0','DWord')
		$regconf = $reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters\\PermittedManagers",$true)
		$regconf.SetValue('1','localhost','string')
		$regconf.SetValue('2','SV002859','string')
		Write-Host "Server: "$MachineName -ForegroundColor Green
		$regconf.GetValue('1')
		$regconf.GetValue('2')
 
		Write-Host "-------------------------------------" -ForegroundColor Green
		$regconft = $reg.OpenSubKey("SYSTEM\\CurrentControlSet\\Services\\SNMP\\Parameters\\ValidCommunities",$true)
		$regconft.SetValue('casimir','4','DWord')
Categories: Windows Tags: , , ,