Hello,
I took a look at the pinned Mass Import from CSV file thread and am running into an issue importing MetaInformation into the RDMSession that my script is importing. I have the following script, mostly copied from the pinned thread, though modified to use updated cmdlets. In testing, the script will add the two servers I have in the CSV file, however when looking in the properties panel, none of the metadata is being populated. I've tested to make sure the script is properly getting the information and looping through it. I do see in the Powershell window WARNING: Connection not found. So I'm wondering if its not properly finding the GUID of the $ServerEntry variable. Using RDM 2020.1 currently. Any thoughts?
Edit: I notice that if I try to access the RDP session in RDM with my imported servers, they won't work unless I open Properties>General, and populate the host by clicking into the Hosts field where it autopopulates. Could this play into the issue?
Edit 2: Added a -Host to the $ServerEntry variable definition to get around the Host field missing. Seems that is not the cause of the metadata issue.
$lineno = 0
Get-Content "C:\temp\RDMImportTest.csv" | ForEach-Object {
$lineno = $lineno + 1
$fields = $_.split(",")
$DeviceName = $fields[0] -replace "^""", "" -replace """$", ""
$Status = $fields[1] -replace "^""", "" -replace """$", ""
$Title = $fields[2] -replace "^""", "" -replace """$", ""
$Audience = $fields[3] -replace "^""", "" -replace """$", ""
$Subnet = $fields[4] -replace "^""", "" -replace """$", ""
$IP = $fields[5] -replace "^""", "" -replace """$", ""
$Description = $fields[6] -replace "^""", "" -replace """$", ""
$VMHost = $fields[7] -replace "^""", "" -replace """$", ""
$POC = $fields[8] -replace "^""", "" -replace """$", ""
$Priority = $fields[9] -replace "^""", "" -replace """$", ""
$Category = $fields[10] -replace "^""", "" -replace """$", ""
$Domain = $fields[11] -replace "^""", "" -replace """$", ""
$WindowsMachine = $fields[12] -replace "^""", "" -replace """$", ""
$OS = $fields[13] -replace "^""", "" -replace """$", ""
$BackupType = $fields[14] -replace "^""", "" -replace """$", ""
$Location = $fields[15] -replace "^""", "" -replace """$", ""
echo "Inserting RDM Entries from input line $lineno : $DeviceName"
$ServerEntry = New-RDMSession -Name $DeviceName -Type "RDPConfigured"
Set-RDMSession $ServerEntry
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property Host -Value "$DeviceName"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property Version -Value "$Status"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property AssetTag -Value "$Title"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property CustomField1Value -Value "$Audience"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property Description -Value "$Description"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property Rack -Value "$VMHost"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property FirstName -Value "$POC"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property CustomField3Value -Value "$Priority"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property CustomField2Value -Value "$Category"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property Domain -Value "$Domain"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property CustomField4Value -Value "$BackupType"
Set-RDMSessionProperty $ServerEntry.ID -Path MetaInformation -Property Rack -Value "$Location"
}Thanks!
Hello,
From what I see, you are very close to the solution.
After calling the
Set-RDMSession $ServerEntry,
# call
Update-RDMUI
This will get rid of the connection not found message.
The Host field you're referring to, also, on my side is called MachineName.
Set-RDMSessionProperty $s.ID -Path MetaInformation -Property MachineName -Value "$DeviceName"
Not to be confused with the actual Host field, which is not part of MetaInformation, but the connection object itself (as you noticed by setting it manually)
In powershell, either use the -Host (as you mentioned), or
$ServerEntry.Host = "$DeviceName"
#and
Set-RDMSession $ServerEntry
At the end of the script, I'd recommend to use another Update-RDMUI and refresh your navigation pane (either the refresh button, of F5)
On a side note, you could also be using this syntax :
$SessionEntry.MetaInformation.MachineName = "$DeviceName"
# ... and all of your assignations THEN
Set-RDMSession $ServerEntry
I hope this help!
Best regards,
Alex Belisle
Thanks Alexandre!
This is great information and cleans up my script quite a bit. Much appreciated!
Hi!
My pleasure, glad I could help!
Let us know if you run into other issues :)
Best regards,
Alex Belisle
When importing, is there a way to set the credential type? Specifically if I want each entry created to, by default, use 'My personal credentials'
Thanks,
Hello,
Take a look over here : https://help.remotedesktopmanager.com/pstipsandtricks.html?q=powershell+credential#essential-information-about-remote-desktop-manager
Best regards,
Alex Belisle