Skip to content

Commit

Permalink
added SetCommunityString to New-OMEDiscovery
Browse files Browse the repository at this point in the history
  • Loading branch information
TrevorSquillario committed Sep 20, 2021
1 parent f7990f5 commit a295b0f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
12 changes: 10 additions & 2 deletions DellOpenManage/Public/OME/New-OMEDiscovery.ps1
Original file line number Diff line number Diff line change
@@ -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":"",
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -229,6 +234,9 @@ param(
[Parameter(Mandatory=$false)]
[Switch]$SetTrapDestination,

[Parameter(Mandatory=$false)]
[Switch]$SetCommunityString,

[Parameter(Mandatory=$false)]
[ValidateSet("RunNow", "RunLater")]
[String]$Schedule = "RunNow",
Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit a295b0f

Please sign in to comment.