Forum / Remote Desktop Manager - PowerShell Repository

Connection Import with children

  • Create an Issue
  • Cancel

Hi Guys,

i'm working on an import script.
This should import me some links from a .csv. This also works wonderfully.

My problem now are the children / sub connections ..
For each connection always include the same children / sub connections.

Example:
Connection 1 (Radmin)
- Subconnection 1 (Radmin)
- Subconnection 2 (Radmin)
- Subconnection 3 (Radmin)
.....

Connection 2 (Radmin)
- Subconnection 1 (Radmin)
- Subconnection 2 (Radmin)
- Subconnection 3 (Radmin)
.....

In the RDM but only the main connection is created plus the last standing in the script children / sub connections.

The Script:
$csv = Import-Csv -Delimiter "" -Encoding UTF7 "c:\temp\nameoflist.csv"
Write-Host;

foreach ($connection in $csv)
{
Write-Host ("Importing : " + ($connection.StoreNr + ' ' + $connection.Store));
Write-Host;

$session = New-RDM-Session -Name ($connection.StoreNr + ' ' + $connection.Store) -Kind "Radmin"
$session.Group = $connection.Customer;
$session.Description = ($connection.StoreNr + ' ' + $connection.Store);
$session.Radmin.Host = "xxx.xxx.xxx.xxx"
$session.Radmin.Color = "Color8bpp"
$session.Radmin.Mode = "FullControl"
$session.VPN.AutoClose = "false"
$session.VPN.CloseMode = "Manually"
$session.VPN.Enabled = "true"
$session.VPN.Mode = "AlwaysConnect"
$session.VPN.Name = "ISDN CONNECTION"
$session.VPN.UserName = "USERNAME"
$session.VPN.VPNSafePassword = 'PW';
$session.VPN.RasPhoneNumber = $connection.RAS;
$session.MetaInformation.City = $connection.Store;
$session.MetaInformation.Phone = $connection.Telefon;
$session.MetaInformation.Softwares = $connection.System;
$session.MetaInformation.OS = $connection.OS;


$session.Children = New-RDM-Session -Name "Connection 1" -Kind "Radmin"
$session.Children.Radmin.Host = "xxx.xxx.xxx.xxx"
$session.Children.Radmin.Color = "Color8bpp"
$session.Children.Radmin.Mode = "FullControl"

$session.Children = New-RDM-Session -Name "Connection 1" -Kind "Radmin"
$session.Children.Radmin.Host = "xxx.xxx.xxx.xxx"
$session.Children.Radmin.Color = "Color8bpp"
$session.Children.Radmin.Mode = "FullControl"

......................


Set-RDM-Session -Session $session -NoRefresh;
}


Any ideas?

Clock6 yrs

Children is actually an array, try the following:

$c1 = New-RDM-Session -Name "Connection 1" -Kind "Radmin"
$c1.Radmin.Host = "xxx.xxx.xxx.xxx"
$c1.Radmin.Color = "Color8bpp"
$c1.Radmin.Mode = "FullControl"

$c2 = New-RDM-Session -Name "Connection 2" -Kind "Radmin"
$c2.Radmin.Host = "xxx.xxx.xxx.xxx"
$c2.Radmin.Color = "Color8bpp"
$c2.Radmin.Mode = "FullControl"


$session.Children = $c1, $c2


edited by stefane on 1/22/2014

Stefane Lavergne

signaturesignature

Clock6 yrs

Perfectly! THX

Clock6 yrs