I am familiar with creating read-only variables and constants in PowerShell by using the Set-Variable command with something like this:
Set-Variable -Option ReadOnly, AllScope -Name STANDARD_TOKEN_PARAMS -Force -Value @{
Username = 'username'
Password = 'password'
ClientId = 'clientID'
}
Or alternatively to sub ReadOnly with Constant for non-removable variables.
I assumed that with the ReadOnly option I would not be able to modify the collection, but this isn't the case. For example, $STANDARD_TOKEN_PARAMS.someNewEntry = 'newEntry' is valid and modifies the collection accordingly.
Are there similar commands that I could use to create a real 'ReadOnly' collection in PowerShell?