extenzo / cSNMP

PowerShell SNMP Resource for DSC
15 stars 6 forks source link

cSNMPManager fails if value already exists #11

Open chuchynz opened 6 years ago

chuchynz commented 6 years ago

Hi, adding an allowed manager IP seems to fail if one already exists.

When the SNMP windows feature is installed, localhost is added by default. When adding a second IP by using cSNMPManager the the configuration reports to fail in the event viewer:

Error Message: The property already exists. Message ID: System.IO.IOException,Microsoft.PowerShell.Commands.NewItemPropertyCommand

If I delete the localhost value and then apply the configuration again it seems to work.

Example of my configuration:

cSNMPManager Manager { Manager = "$SNMPHost" Ensure = "Present" DependsOn = '[WindowsFeature]SNMPRSAT' }

Am I doing something wrong here? I assume it should add another value in addition to any that already exist? Thanks in advance for the help.

ripclawffb commented 3 years ago

Looks like this was fixed in PR #12 but a new release hasn't been pushed to PowerShell Gallery. @fabiendibot can you push a new version of the package out?

Also, what was the reasoning of skipping item 1 in the first place? It looks like it's skipping in 2 other places as well.

https://github.com/extenzo/cSNMP/blob/master/DSCResources/cSNMPManager/cSNMPManager.psm1#L14 https://github.com/extenzo/cSNMP/blob/master/DSCResources/cSNMPManager/cSNMPManager.psm1#L101

Do those lines need to be modified too?

Thanks!