Forum / Remote Desktop Manager - PowerShell Repository

Import your TechNet Subscription (via XML)

First export your TechNet Subscription keys using this link

https://technet.microsoft.com/en-us/subscriptions/keys/

Serial Data entry is actually an AddOn therefore we need to jump through hoops to make it work.

SerialDataEntryConfiguration & DataEntryConnectionTypeInfo are two internal classes that are not documented. One needs internal workings to be able to write this type of script.

Enjoy

cls;
[xml]$rss = Get-Content $args[0];
foreach ($product in $rss.YourKey.Product_Key)
{
Write-Host $product.Name;

$session = New-RDM-Session -Name $product.Name -Kind "DataEntry"
$session.Group = "TechNet Keys"
$session.MetaInformation.CustomField1Title = "Key type"
$session.MetaInformation.CustomField1Value = $product.Key.Type;
$session.MetaInformation.CustomField2Title = "Claimed date"
$session.MetaInformation.CustomField2Value = $product.Key.ClaimedDate;

$configuration = New-Object RemoteDesktopManager.AddOn.SerialDataEntryAddOn.SerialDataEntryConfiguration;
$configuration.Software = $product.Name;
$configuration.Serial = $product.InnerText;
$xml = $configuration.ToXml();

$dataEntryConnectionTypeInfo = New-Object Devolutions.RemoteDesktopManager.Business.DataEntryConnectionTypeInfo;
$dataEntryConnectionTypeInfo.DataEntryConnectionType = 7 <# AddOn #>;
$dataEntryConnectionTypeInfo.SubConnectionType = "a067caf6-848a-4f33-9926-d03f9702aaf5"
$dataEntryConnectionTypeInfo.Data = $xml;

$session.DataEntry.ConnectionTypes.Add($dataEntryConnectionTypeInfo);

Set-RDM-Session $session -NoRefresh;
}


edited by stefane on 4/11/2013

Stefane Lavergne

signaturesignature

Clock6 yrs

I'm not having much luck importing my first powershell script. I'm guessing this should be added as a local powershell script?

I get the following error running this:

At line:1 char:60
+ & { 'C:\Users\Towers\SkyDrive\Scripts\Technet\Technet.ps1'
'C:\Users\Towers\SkyD ...
+
~~~~~~~~~~~~~~~~~~~~~
Unexpected token ''C:\Users\Towers\SkyDrive\Scripts\Technet\KeysExport.xml''
in expression or statement.
+ CategoryInfo : ParserError: (smile [], ParentContainsErrorRecordEx
ception
+ FullyQualifiedErrorId : UnexpectedToken


I'm not entirely sure what's going wrong. Any ideas?

Clock5 yrs

In the case of the script above you could create it via a PowerShell session but you would need the extra step of loading the RDM PowerShell snap-in. Something like this:

Get-PSSnapin -Name *Remote.Desktop* -Registered | % { Write-Host "$_..." -NoNewline; if ( (Get-PSSnapin -Name $_ -ErrorAction SilentlyContinue) -eq $null ) { Write-Host "installing" -ForegroundColor Yellow; Add-PsSnapin $_ } else { Write-Host "already installed" -ForegroundColor Green;  } }

But in this case it would be simpler to use Tools -> PowerShell (RDM CmdLet). This will start a PowerShell command prompt with the RDM snap-in loaded. You need only to run the script and all should work.

C:\Users\Towers\SkyDrive\Scripts\Technet\Technet.ps1 ''C:\Users\Towers\SkyDrive\Scripts\Technet\KeysExport.xml''

Let me know if that works for you.

Stefane Lavergne

signaturesignature

Clock5 yrs