The default JSON works as expected.
{
"Objects": [
{
"Type": "Credential",
"Name": "Root",
"Username": "root",
"Password": "!ehrfew9fe9gew7rgew@",
"ID": "000001",
"Path": "/Credentials"
}, {
"Type": "Folder",
"Name": "Connections",
"Objects": [
{
"Type": "TerminalConnection",
"TerminalConnectionType": "SSH",
"Name": "VM01",
"ComputerName": "vm01",
"CredentialID": "000001"
}
]
}
]
}
However, the default PowerShell script fails despite being identical in end JSON layout.
$ErrorActionPreference = "Stop"
@{
Objects = (
@{
Type = "Credential";
Name = "Root";
Username = "root";
Password = "!ehrfew9fe9gew7rgew@";
ID = "000001";
Path = "/Credentials";
},
@{
Type = "Folder";
Name = "Connections";
Objects = @(
@{
Type = "TerminalConnection";
TerminalConnectionType = "SSH";
Name = "VM01";
ComputerName = "vm01";
CredentialID = "000001";
};
);
}
)
} |
ConvertTo-Json -Depth 100 |
Write-Host
The error received is as follows (provided as an image and text just in case):
An error occurred while parsing the output of a dynamic folder’s script: Unexpected character encountered while parsing value: P.Path", line 0, position 0.