Powershell for Dynamic Folders Incorporating Properties
J
James Healey
started a topic
almost 7 years ago
Hi,
I am using the powershell example on the support site to try to create Dynamic Folders for WebConnections. I have no issue creating the base object from a CSV, but I'm getting stuck at adding other properties.
From the examples for Dynamic Folders I've modified it to create a webconnection, but trying to add in other properties does not work. For example in the code below, it imports and runs with no errors, but IgnoreCertificateErrors = True does not do anything. Similar if using UseDedicatedEngine = True also does not check that check box.
James Healey
Hi,
I am using the powershell example on the support site to try to create Dynamic Folders for WebConnections. I have no issue creating the base object from a CSV, but I'm getting stuck at adding other properties.
From the examples for Dynamic Folders I've modified it to create a webconnection, but trying to add in other properties does not work. For example in the code below, it imports and runs with no errors, but IgnoreCertificateErrors = True does not do anything. Similar if using UseDedicatedEngine = True also does not check that check box.
$ErrorActionPreference = "Stop" $computers = Import-Csv "$CustomProperty.CSVPath$" $connections = @() ForEach ($computer in $computers) { $name = $computer.Name $computerName = $computer.ComputerName $username = $computer.Username $password = $computer.Password $connection = New-Object pscustomobject -Property @{ "Type" = "WEBConnection"; "Name" = $name; "ComputerName" = "HTTPS://" + $computerName + "/xui"; "IgnoreCertificateErrors" = "True"; } $connections += $connection } @{ Objects = $connections } | ConvertTo-Json -Depth 100 | Write-HostIf anyone has any ideas please let me know.
Many Thanks!
Hi,
please check out our updated docs here:
https://www.royalapplications.com/go/kb-all-royaljson
In the documentation PDF you can find a chapter:
Advanced scenarios
I hope this helps.
Regards,
Stefan
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstJames Healey
Sorry Figured out my own issue. In order to add in "Properties" you need to include a properties HASH table.
So my code above looks like this:
$ErrorActionPreference = "Stop" $computers = Import-Csv "$CustomProperty.CSVPath$" $connections = @() ForEach ($computer in $computers) { $name = $computer.Name $computerName = $computer.ComputerName $connection = New-Object pscustomobject -Property @{ "Type" = "WebConnection"; "Name" = $name; "ComputerName" = "HTTPS://" + $computerName; "CredentialName" = "BARRIE-ROOT"; "Properties" = @{ "UseDedicatedEngine" = "True" } } $connections += $connection } @{ Objects = $connections } | ConvertTo-Json -Depth 100 | Write-HostNote the "Properties" = @{} section in order to add in the extra properties.
Thanks
James
Stefan Koell
Hi,
please check out our updated docs here:
https://www.royalapplications.com/go/kb-all-royaljson
In the documentation PDF you can find a chapter:
Advanced scenarios
I hope this helps.
Regards,
Stefan
-
What happened to the forum?
-
About this Forum
-
Security Information
-
Supported Secure Gateway (SSH) ciphers
-
Why is no remote file browser in SCP available?
-
What encryption is used in the rtsz files when enabled?
-
Royal TS V4 License File
-
How to resolve RDP resolution issues in Windows 7 with high resolution screen
-
Auto Fill in web page connection
-
How to reference custom properties in tasks and templates?
See all 295 topics