From a295b0f28658a1905362e3b9e24da29f109102da Mon Sep 17 00:00:00 2001 From: Squillario Date: Mon, 20 Sep 2021 17:50:14 -0400 Subject: [PATCH] added SetCommunityString to New-OMEDiscovery --- DellOpenManage/Public/OME/New-OMEDiscovery.ps1 | 12 ++++++++++-- README.md | 11 +++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/DellOpenManage/Public/OME/New-OMEDiscovery.ps1 b/DellOpenManage/Public/OME/New-OMEDiscovery.ps1 index 7c2fa64..96cf8e5 100644 --- a/DellOpenManage/Public/OME/New-OMEDiscovery.ps1 +++ b/DellOpenManage/Public/OME/New-OMEDiscovery.ps1 @@ -1,5 +1,5 @@  -function Get-DiscoverDevicePayload($Name, $HostList, $DeviceType, $DiscoveryUserName, [SecureString] $DiscoveryPassword, $Email, $SetTrapDestination, $UseAllProtocols, $Schedule, $ScheduleCron) { +function Get-DiscoverDevicePayload($Name, $HostList, $DeviceType, $DiscoveryUserName, [SecureString] $DiscoveryPassword, $Email, $SetTrapDestination, $SetCommunityString, $UseAllProtocols, $Schedule, $ScheduleCron) { $DiscoveryConfigPayload = '{ "DiscoveryConfigGroupName":"Server Discovery", "DiscoveryStatusEmailRecipient":"", @@ -72,6 +72,9 @@ function Get-DiscoverDevicePayload($Name, $HostList, $DeviceType, $DiscoveryUser if ($SetTrapDestination) { $DiscoveryConfigPayload.TrapDestination = $true } + if ($SetCommunityString) { + $DiscoveryConfigPayload.CommunityString = $true + } # Add version check for UseAllProfiles if ($SessionAuth.Version -ge [System.Version]"3.5.0") { if ($UseAllProtocols) { @@ -174,6 +177,8 @@ limitations under the License. Email upon completion .PARAMETER SetTrapDestination Set trap destination of iDRAC to OpenManage Enterprise upon discovery +.PARAMETER SetCommunityString + Set Community String for trap destination from Application Settings > Incoming Alerts > SNMP Listener .PARAMETER UseAllProtocols Execute all selected protocols when discovering devices. This will increase this discovery task's execution time. .PARAMETER Schedule @@ -229,6 +234,9 @@ param( [Parameter(Mandatory=$false)] [Switch]$SetTrapDestination, + [Parameter(Mandatory=$false)] + [Switch]$SetCommunityString, + [Parameter(Mandatory=$false)] [ValidateSet("RunNow", "RunLater")] [String]$Schedule = "RunNow", @@ -269,7 +277,7 @@ Process { $DiscoverUrl = $BaseUri + "/api/DiscoveryConfigService/DiscoveryConfigGroups" if ($Hosts.Count -gt 0) { - $Payload = Get-DiscoverDevicePayload -Name $Name -HostList $Hosts -DeviceType $DeviceType -DiscoveryUserName $DiscoveryUserName -DiscoveryPassword $DiscoveryPassword -Email $Email -SetTrapDestination $SetTrapDestination -UseAllProtocols $UseAllProtocols -Schedule $Schedule -ScheduleCron $ScheduleCron + $Payload = Get-DiscoverDevicePayload -Name $Name -HostList $Hosts -DeviceType $DeviceType -DiscoveryUserName $DiscoveryUserName -DiscoveryPassword $DiscoveryPassword -Email $Email -SetTrapDestination $SetTrapDestination -SetCommunityString $SetCommunityString -UseAllProtocols $UseAllProtocols -Schedule $Schedule -ScheduleCron $ScheduleCron $Payload = $Payload | ConvertTo-Json -Depth 6 $DiscoverResponse = Invoke-WebRequest -Uri $DiscoverUrl -UseBasicParsing -Method Post -Body $Payload -Headers $Headers -ContentType $Type if ($DiscoverResponse.StatusCode -eq 201) { diff --git a/README.md b/README.md index edaccb5..950425f 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,17 @@ 3. List available Modules `Get-Module Dell* -ListAvailable` 4. Import module `Import-Module DellOpenManage` +## Contributing + +Integration tests will be performed against all pull requests before merging + +1. Fork the Project +2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`) +3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`) +4. Push to the Branch (`git push origin feature/AmazingFeature`) +5. Open a Pull Request + + # Command Reference See [Command Reference](Documentation/CommandReference.md)