Start a new topic

PowerShell remote set username and password for RoyalCredential

So i managed to create a new RoyalDocument and add a RoyalCredential object using the latest powershell module which is awesome! But i checked the website object info: XX and i can't seem to find the properties to set a username and password for that RoyalCredential. So the question is how would one set these properties for this object?


Off topic but is there also a .NET based which we can use instead of the powershell module?


Hi Nico,


to set the username and password on the RoyalCredential object, check out these properties:

https://content.royalapplications.com/Help/RoyalTS/V5/index.html?scripting_objectproperties_royalcredential.htm

The properties are UserName and Password


To assign the credential object by ID to the web page connection, use the following properties from the Credential category:

https://content.royalapplications.com/Help/RoyalTS/V5/index.html?scripting_objectproperties_royalwebconnection.htm


Set CredentialMode to 3

Set CredentialId to the ID of the Credential object


Let me know if this helps.


Regards,
Stefan

Hey Stefan,


Thanks for your quick response. i now see i was looking in the helpdocs of version 4 and not 5 that's why i missed the properties, doh! 


With the new information i tried to run this command:

$CredFolder = Get-RoyalObject -Folder $royalDocument -Type RoyalFolder -Name "Credentials"
$cred = New-RoyalObject -Type RoyalCredential -Folder $CredFolder -Name "Default Pass" -UserName "user" -Password "pass"

 

But that results in this error:  

New-RoyalObject : A parameter cannot be found that matches parameter name 'UserName'.

 Am i missing something?


Additional to above i'm running on RoyalDocument.PowerShell Version: 5.2.60224.0 and if i use the intellisence option of powershell to see which properties are available then i can't see -UserName or -Password

The same also applies to RoyalWebConnection, saying URI not found:

 

New-RoyalObject -Type RoyalWebConnection -Folder $folder -Name "MyName" -URI "192.168.0.45"

 

Hi Nico,


you can't use those cmdlets to manipulate/set the values of the properties directly. Once you created the object, you need to use a different cmdlet to set the properties:

To set the value use this:

https://content.royalapplications.com/Help/RoyalTS/V5/index.html?scripting_commandlets_set-royalobjectvalue.htm


To get a value use this:

https://content.royalapplications.com/Help/RoyalTS/V5/index.html?scripting_commandlets_get-royalobjectvalue.htm


See also our getting started topic, "Working with Objects":

https://content.royalapplications.com/Help/RoyalTS/V5/index.html?scripting_gettingstarted.htm


You may also want to look at some of our sample scripts to see how the cmdlets are used:

https://content.royalapplications.com/Help/RoyalTS/V5/index.html?scripting_samplescripts.htm


Let me know if this helps.


Regards,
Stefan

Hey Stefan,


Ah that how! Got it working now, thanks!


Other questions, 

1. How can i choose between the Chrome or Edge browser component? And how does it work with the new Chromium based edge?

2. Is support for AnyDesk on the roadmap?

Glad to hear that!


Regarding your other questions: there's currently not an Edge browser component. The SDK is quite fresh and I'm not sure if we can make it work in the V6 release.

AnyDesk: currently there's no short or mid-term plan to integrate AnyDesk since there's no SDK to integrate their viewer into the app. The best bet would be to integrate it using the External Application connection type:

https://content.royalapplications.com/Help/RoyalTS/V5/index.html?reference_externalapp.htm


Regards,
Stefan

Alright, that answers my questions!


Another one ;-) How would one set the default plugin to Chrome for the entire document or per WebConnection?

Using PowerShell, you can do it by setting the UseGlobalPlugInWin property to false and the PlugInWin property to the Chrome Plugin GUID (F008C2F0-5FB3-4C5E-A8EB-8072C1183088)


The easiest way to find that out would be to create a document for testing with the object, set the property in the UI and see which properties are set in the .rtsz XML.


Let me know if this helps.


Regards,
Stefan

Thanks, works like a charm!


Also thanks for the tip. Didn't know the file is an XML so will defitnley use your debug tip.


Although i noticed a strange behaviour maybe you could shed some light on it. When i create a new document and then create a new webconnection i fill in all the properties needed for automatic login. But when the document is opend and i Connect to the webconnection autologon doesn't work until i open the properties then go to the AutoFill tab, then click OK to close the Dialog that has popup and then click OK to close the propertiesdialog again. Now when you Connect to the webconnection the autologon works.


I used your tip of observing the document XML file and noticed some different properties but still it doesn't work. This is what i got:  

$folder = New-RoyalObject -Type RoyalFolder -Folder $ProjectFolder -Name "Test Triple Lab" -Description "Created on 4-9-2020 15:29:22"
$cred = New-RoyalObject -Type RoyalCredential -Folder $CredFolder -Name "Test CombiNode" -Description "Created on 4-9-2020 15:29:22"
Set-RoyalObjectValue -Object $cred -Property UserName -Value "user"
Set-RoyalObjectValue -Object $cred -Property Password -Value ""
$ConObj = New-RoyalObject -Type RoyalWebConnection -Folder $folder -Name "Test CombiNode" -Description "Test Node"
Set-RoyalObjectValue -Object $ConObj -Property CredentialMode -Value 3
Set-RoyalObjectValue -Object $ConObj -Property CredentialId -Value $cred.ID
Set-RoyalObjectValue -Object $ConObj -Property URI -Value "192.168.70.120"
Set-RoyalObjectValue -Object $ConObj -Property UseBasicAuth -Value $true
Set-RoyalObjectValue -Object $ConObj -Property IgnoreCertificateErrors -Value $true
Set-RoyalObjectValue -Object $ConObj -Property UseGlobalPlugInWin -Value $false
Set-RoyalObjectValue -Object $ConObj -Property PlugInWin -Value "F008C2F0-5FB3-4C5E-A8EB-8072C1183088"
Set-RoyalObjectValue -Object $ConObj -Property AutoFillMappingX -Value "{}"
Set-RoyalObjectValue -Object $ConObj -Property AutoFillMapping -Value "{}"
Set-RoyalObjectValue -Object $ConObj -Property AutoFillDelay -Value 200
Set-RoyalObjectValue -Object $ConObj -Property CredentialAutologon -Value $true

  

And that generates this:

 

  <RoyalWebConnection>
    <ID>5753891b-c613-4502-8ce4-21bf53f1f0bb</ID>
    <Name>Test CombiNode</Name>
    <Modified>09/04/2020 13:35:38.827</Modified>
    <Created>09/04/2020 13:35:38.125</Created>
    <ModifiedBy>\My User</ModifiedBy>
    <CreatedBy>\My User</CreatedBy>
    <PositionNr>2</PositionNr>
    <IsConnectionTemplate>False</IsConnectionTemplate>
    <ParentID>e1f9bf53-a695-4fe3-a91d-25c6a1a069fa</ParentID>
    <ObjectSpecialUsage />
    <URI>192.168.70.120</URI>
    <Description>Test Node</Description>
    <CustomField11 />
    <CustomField12 />
    <CustomField13 />
    <CustomField14 />
    <CustomField15 />
    <CustomField16 />
    <CustomField17 />
    <CustomField18 />
    <CustomField19 />
    <CustomField20 />
    <CustomProperties />
    <CredentialPassword />
    <CredentialPassphrase />
    <ProxyPassword />
    <ProxyBypass />
    <CredentialMode>3</CredentialMode>
    <CredentialId>433e28f0-782d-40bd-bbfb-da3e53dbf3b6</CredentialId>
    <UseBasicAuth>True</UseBasicAuth>
    <IgnoreCertificateErrors>True</IgnoreCertificateErrors>
    <UseGlobalPlugInWin>False</UseGlobalPlugInWin>
    <PlugInWin>F008C2F0-5FB3-4C5E-A8EB-8072C1183088</PlugInWin>
    <AutoFillDelay>200</AutoFillDelay>
    <CredentialAutologon>True</CredentialAutologon>
  </RoyalWebConnection>

 




Hi,


you won't see the AutoFillMapping properties if you set the value to "{}" as this is the default value. When we persist the objects to disk, we only store data different from their default values.


I hope this makes sense.


Regards,

Stefan

Login or Signup to post a comment