Create IP-List with PowerShell

Create IP-List with PowerShell

1 vote

avatar

Hi there

I tried to create the IP-List with PowerShell, but there is no EntryType for "IPList" (I found that information in an exported entry).

Please add the ability to add the IP-List with PowerShell.

Best regards, John

All Comments (3)

avatar

Hi John,

Thank you for raising this. In the module, an IP List isn’t its own entry type. It’s a Data Entry whose subtype is IPList, which is why New-RDMEntry -Type doesn’t offer it. We will add cmdlets to make it easier to create IP List entries and manage their items from PowerShell.

Until then, you can create and populate an IP List by setting the entry’s properties directly. To see which fields are relevant for a given entry type, check this page: https://docs.devolutions.net/powershell/remote-desktop-manager-powershell/powershell-scripting/list-of-property-names-for-powershell-script

Here is an example that creates an IP List with two items and saves it in the current vault:

$entry = New-RDMEntry -Name 'Office network' -Type DataEntry

# Make the data entry an IP List
$entry.DataEntry.ConnectionTypeInfos = @(@{ DataEntryConnectionType = 'IPList' })
$entry.DataEntry.IPListDisplayMode = 'Simple'   # or 'Advanced'

# Add the IP items
$entry.DataEntry.IPList = @(
    @{ Name = 'DC01'; Host = 'dc01.contoso.local'; IP = '10.0.0.10'; Description = 'Domain controller' }
    @{ Name = 'FS01'; Host = 'fs01.contoso.local'; IP = '10.0.0.20'; Description = 'File server' }
)

Set-RDMEntry -InputObject $entry


Each item may also have IPRange, Subnet, VlanID, Gateway, FirewallZone, DHCPServer, and DHCPRange.

To add items to an existing IP List, get the entry, append to the list, and save it:

$entry = Get-RDMEntry -Name 'Office network'
$entry.DataEntry.IPList += @{ Name = 'PRN01'; Host = 'prn01.contoso.local'; IP = '10.0.0.30' }
Set-RDMEntry -InputObject $entry


Best regards,
Maxime

avatar

Hi Maxime

Is there also a way to set the following properties?

  • Name = Variable
  • Typ = Variable
  • Folder = Variable
  • IPListEntryMode = Dynamic
  • Keywords = EXCL_IP_LIST
  • FilterByFolder = True
  • FilterByKeywords = True
  • TagOperator = Exclude


Best regards, John

avatar

Hi John,

Yes, all of these can be set. Here is an example:

$name         = 'My IP list'
$entryFolder  = 'Test'          # folder where the entry is created
$filterFolder = 'Test\Test1'   # folder the dynamic list scans
$keywordNames = '"Tag with space" SpacelessTag'

$entry = New-RDMEntry -Name $name -Type DataEntry -Group $entryFolder

$entry.DataEntry.ConnectionTypeInfos   = @(@{ DataEntryConnectionType = 'IPList' })
$entry.DataEntry.IPListEntryMode       = 'Dynamic'
$entry.DataEntry.IPListDynamicSettings = @{
    Folder           = $filterFolder
    FilterByFolder   = $true
    Keywords         = $keywordNames
    FilterByKeywords = $true
    TagOperator      = 'Exclude'
}

Set-RDMEntry -InputObject $entry


If you need anything else, let us know.

Best regards,
Maxime