Powershell import for webBrowser connections

Powershell import for webBrowser connections

avatar

Not sure if this is the correct forum for this, feel free to move it if not.

I am trying to import from a simple CSV file to create RDM web browser sessions.

Attached is a sample CSV file that I am using. I have tried putting double quotes around the entries in the CSV file with no change. What I get is in the properties of the connection that gets created the web browser URL is filled with this "@{name=RDM; url=http://www.devolutions.net}.url

Below is the code


cls;

$csv = Import-Csv c:\simple.csv;
Write-Host;

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

$session = New-RDM-Session -Name $connection.name -Group "Testing Folder" -Kind "WebBrowser"



Set-RDM-Session -Session $session -NoRefresh;
Set-RDM-Property $session.ID -Property WebBrowserUrl -Value "$connection.url" -NoRefresh
}
edited by debell67 on 12/19/2013

simple.csv

All Comments (6)

avatar

Could you please post your sample csv file.

Stéfane Lavergne

avatar

Stéfane Lavergne

avatar

Updated my original post with the attachment. Sorry about that I forgot to actually attach it. Actually started off with the link you posted but what I wanted to do was a little different. The post you refer to creates a data entry link and what I am trying to do is create a web browser session.

avatar

Thanks, I will have a look

Stéfane Lavergne

avatar

This should work. Note I'm setting a few more values (just for fun). In this case the session are configured to use the Firefox embedded browser.


cls;

$csv = Import-Csv $args[0];
Write-Host;

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

$session = New-RDM-Session -Name $connection.name -Kind "WebBrowser"
$session.WebBrowserUrl = $connection.url;
$session.OpenEmbedded = $True;
$session.ConnectionSubType = "FireFox"
$session.WebBrowserApplication = 3; # WebBrowserApplication.FireFox;
Set-RDM-Session -Session $session -NoRefresh;
}

Stéfane Lavergne

avatar

Haven't had a chance to load my full set of data but with the dummy info I had in there it works great. Thanks. Just need to make the minor tweaks of setting the group and probably removing the firefox so it will use IE but should be able to handle that without too much issue.

Thanks again