Start a new topic
Solved

Dynamic Folder / CustomProperties

Hi there!


I'm creating a dynamic folder from AD with a powershell script. I'm wondering how to add the properties 


EnableConvenienceKeyForwards 

EnableWindowsKey 


to the RDP Connection. Basically my Script is working perfectly - I'm just not able to "activate" those features. Can you help on that?


Basically that's the call which creates the psobject which get's converted in a json object afterwards.


I tried it with a nested property - but this does not work:

$null = $Servers.Add([PSCustomObject]@{
  Name = $PSItem.Name
  Type = 'RemoteDesktopConnection'
  ComputerName = $PSItem.Name
  CredentialName = 'high_secure_credential_entry'
  CustomProperties = @{
      EnableConvenienceKeyForwards = $true
      EnableWindowsKey = $true
  }

  Path = $PSItem.CanonicalName.Replace("/$($PSItem.Name)",'')
})

$RoyalTSObjects = @{}
$null = $RoyalTSObjects.Add('Objects',$Servers)
$RoyalTSObjects | ConvertTo-Json -depth 3

 



This is an example output with my script: 

{
  "Objects": [
    {
      "Name": "SERVER_A",
      "Type": "RemoteDesktopConnection",
      "ComputerName": "SERVER_A",
      "CredentialName": "high_secure_credential",
      "CustomProperties": {
        "EnableWindowsKey": true,
        "EnableConvenienceKeyForwards": true
      },
      "Path": "contoso.com/SERVERS/"
    }
  ]
}

  Thx for your help guys!


Hi!


instead of "CustomProperties" use "Properties":

https://docs.royalapps.com/r2023/scripting/rjson/advanced-scenarios.html


Regards,

Stefan

Hi Stefan!


Thx for your answer - that worked like a breeze!

Now it's working as expected


Thx for your help and have a nice time!

Cheers Florian




You're welcome. Glad I could help.

Login or Signup to post a comment