Forum / Remote Desktop Manager - Macro/Script/Tools

add the ip address to all entries

  • Create an Issue
  • Cancel

Hi,

What is the best way to add only the IP of a server to the information section of all the entries ?
Load from inventory is too comperhensive and takes a lot of time per entry (and I do not need all the info for now).

Script ?
Enhance the load from inventory so the user can choose what to load ?

Thanks


Snir

Clock4 yrs

Hello,

This will be possible with PowerShell.

I don't know what is your knowledge with PowerShell. If you need help to build the script, let us know.

Best regards,



Jeff Dagenais

signaturesignature

Clock4 yrs

I currentry unable to set the property for IP so I will see it on the property page.

The syntax is:

Set-RDM-Property -ID "{f195ea3d-379d-4e3f-a308-b89c72db972c}" "MetaInformation" -Property "IP" "1.1.1.1"

I do see it when I execute the get-rdm-property command but not at the properties in the GUI. (I need it there because I want to search servers via IP)

...?

Snir

Clock4 yrs

Could you help me create the entire script ?

I have the part for IP resolving:

[System.Net.Dns]::GetHostAddresses("cnn.com")[0] | foreach {echo $_.IPAddressToString }

...?

Snir

Clock4 yrs

Hi,

Here's a way how you could do it:

$sessions = Get-RDMSession
foreach ($session in $sessions)
{
if ([string]::IsNullOrEmpty($session.Host))
{
continue
}

# Remove the # if you don't the script to overwrite the IP address
#if (![string]::IsNullOrEmpty($session.MetaInformation.IP))
#{
# continue
#}

$session.MetaInformation.IP = (Resolve-DnsName $session.Host -NetbiosFallback -NoHostsFile -Type A).IPAddress
Write-Host "Name: $($session.Name) - Host: $($session.Host) - IP Address: $($session.MetaInformation.IP)"
Set-RDMSession $session
}
Write-Host 'Done!'
Update-RDMUI

If you don't have the Resolve-DnsName cmdlet, you can replace Resolve-DnsName by [System.Net.Dns]::GetHostAddresses($session.Host)[0].

Don't hesitate if you have any questions.

Best regards,

Olivier Désalliers

signaturesignature

Clock4 yrs

Thanks, it's working...

But I returning to my question above:


I do see the ip when I execute the get-rdm-property command but not at the properties in the GUI. (I need it there because I want to search servers via IP)




...?




Snir

2016-08-24_08h39_46.png
2016-08-24_08h38_53.png
Clock4 yrs

Hi,

If you set a property using Set-RDMProperty or by using directly the property. You need to set the session by using Set-RDMSession then refresh your data source otherwise you won't see the changes in the UI.

Does it work if you do something like this:

$session = Get-RDMSession | Where-Object {$_.Name -eq "PTNT555P"}
$session.MetaInformation.IP = (Resolve-DnsName $session.Host -NetbiosFallback -NoHostsFile -Type A).IPAddress
Set-RDMSession $session
Update-RDMUI

Best regards,

Olivier Désalliers

signaturesignature

Clock4 yrs

It does not work...

When I update in the ui I do not see it on the get-rdmproperty and when I set a property I do not see it on the ui.

My data source is SQL if it make any difference...

Snir

Clock4 yrs

Hi,

Could you try to clear your cache by doing Ctrl-F5 or by clicking on the refresh button with ctrl pressed.

If you try on another data source, does it work?

Best regards,

Olivier Désalliers

signaturesignature

Clock4 yrs

Ctrl+F5 did not help.

But... when I changed the data source to local db it worked.

is the problem SQL data source ?

Clock4 yrs

Any news ?

Clock4 yrs

Hello Snir,

We would like to do a remote session with you to help you with this issue.

I will send you via private message a link to schedule an appointment.

Best regards,



Jeff Dagenais

signaturesignature

Clock4 yrs

Thanks for the meeting yesterday, the problem was that I was not connected to the correct data source.


Snir

Clock4 yrs