thycotic-ps / thycotic.secretserver

PowerShell module for automating with Thycotic Secret Server REST API
https://thycotic-ps.github.io/thycotic.secretserver
MIT License
68 stars 22 forks source link

Get-TssSecretSetting unable to Convert Value #277

Closed dlisterjr closed 2 years ago

dlisterjr commented 2 years ago

Verified issue does not already exist?

Yes

What error did you receive

PSMessageDetails : Exception : System.Management.Automation.RuntimeException: Cannot convert value "@{sendEmailWhenViewed=False; sendEmailWhenChanged=False; sendEmailWhenHeartbeatFails=True; rdpLauncherSettings=; sshLauncherSettings=; oneTimePasswordSettings=; expirationType=Template; expirationDayInterval=; expirationDate=; expirationTemplateText=Expires every 365 day(s); jumpboxRouteSelection=}" to type "Thycotic.PowerShell.Secrets.DetailSettings". Error: "Cannot convert the "@{sendEmailWhenViewed=False; sendEmailWhenChanged=False; sendEmailWhenHeartbeatFails=True; rdpLauncherSettings=; sshLauncherSettings=; oneTimePasswordSettings=; expirationType=Template; expirationDayInterval=; expirationDate=; expirationTemplateText=Expires every 365 day(s); jumpboxRouteSelection=}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Secrets.DetailSettings"." ---> System.Management.Automation.PSInvalidCastException: Cannot convert value "@{sendEmailWhenViewed=False; sendEmailWhenChanged=False; sendEmailWhenHeartbeatFails=True; rdpLauncherSettings=; sshLauncherSettings=; oneTimePasswordSettings=; expirationType=Template; expirationDayInterval=; expirationDate=; expirationTemplateText=Expires every 365 day(s); jumpboxRouteSelection=}" to type "Thycotic.PowerShell.Secrets.DetailSettings". Error: "Cannot convert the "@{sendEmailWhenViewed=False; sendEmailWhenChanged=False; sendEmailWhenHeartbeatFails=True; rdpLauncherSettings=; sshLauncherSettings=; oneTimePasswordSettings=; expirationType=Template; expirationDayInterval=; expirationDate=; expirationTemplateText=Expires every 365 day(s); jumpboxRouteSelection=}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Secrets.DetailSettings"." ---> System.Management.Automation.PSInvalidCastException: Cannot convert the "@{sendEmailWhenViewed=False; sendEmailWhenChanged=False; sendEmailWhenHeartbeatFails=True; rdpLauncherSettings=; sshLauncherSettings=; oneTimePasswordSettings=; expirationType=Template; expirationDayInterval=; expirationDate=; expirationTemplateText=Expires every 365 day(s); jumpboxRouteSelection=}" value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Secrets.DetailSettings". ---> System.InvalidOperationException: The jumpboxRouteSelection property was not found for the Thycotic.PowerShell.Secrets.DetailSettings object. The available property is: [ExpirationDate <System.Nullable`1[[System.DateTime, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]>] , [ExpirationDayInterval

] , [ExpirationTemplateText ] , [ExpirationType ] , [OneTimePasswordSettings ] , [RdpLauncherSettings ] , [SendEmailWhenChanged ] , [SendEmailWhenHeartbeatFails ] , [SendEmailWhenViewed ] , [SshLauncherSettings ] at System.Management.Automation.LanguagePrimitives.CreateMemberNotFoundError(PSObject pso, DictionaryEntry property, Type resultType) at System.Management.Automation.LanguagePrimitives.SetObjectProperties(Object o, IDictionary properties, Type resultType, MemberNotFoundError memberNotFoundErrorAction, MemberSetValueError memberSetValueErrorAction, Boolean enableMethodCall, IFormatProvider formatProvider, Boolean recursion, Boolean ignoreUnknownMembers) at System.Management.Automation.LanguagePrimitives.SetObjectProperties(Object o, PSObject psObject, Type resultType, MemberNotFoundError memberNotFoundErrorAction, MemberSetValueError memberSetValueErrorAction, IFormatProvider formatProvider, Boolean recursion, Boolean ignoreUnknownMembers) --- End of inner exception stack trace --- at System.Management.Automation.LanguagePrimitives.SetObjectProperties(Object o, PSObject psObject, Type resultType, MemberNotFoundError memberNotFoundErrorAction, MemberSetValueError memberSetValueErrorAction, IFormatProvider formatProvider, Boolean recursion, Boolean ignoreUnknownMembers) at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable, Boolean ignoreUnknownMembers) --- End of inner exception stack trace --- at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable, Boolean ignoreUnknownMembers) at System.Management.Automation.LanguagePrimitives.ConvertViaNoArgumentConstructor.Convert(Object valueToConvert, Type resultType, Boolean recursion, PSObject originalValueToConvert, IFormatProvider formatProvider, TypeTable backupTable) at CallSite.Target(Closure , CallSite , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute1[T0,TRet](CallSite site, T0 arg0) at System.Management.Automation.Interpreter.DynamicInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame) --- End of inner exception stack trace --- TargetObject : CategoryInfo : InvalidArgument: (:) [], RuntimeException FullyQualifiedErrorId : InvalidCastConstructorException ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at Get-TssSecretSetting, C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.6\functions\secrets\Get-TssSecretSetting.ps1: line 64 at , : line 1 PipelineIterationInfo : {} ### Please run the command using -Verbose Get-TssSecretSetting -TssSession $session -id 2148 -verbose VERBOSE: Command invocation: Get-TssSecretSetting -TssSession:TssSessionObject -Id:System.Int32[] -Verbose:True VERBOSE: Performing the operation GET https://secretserver.omnicell.com/SecretServer/api/v1/secrets/2148/settings with InvalidArgument: C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.6\functions\secrets\Get-TssSecretSetting.ps1:64 Line | 64 | … [Thycotic.PowerShell.Secrets.DetailSettings]$restResponse … | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | Cannot convert value "@{sendEmailWhenViewed=False; sendEmailWhenChanged=False; sendEmailWhenHeartbeatFails=True; rdpLauncherSettings=; sshLauncherSettings=; oneTimePasswordSettings=; | expirationType=Template; expirationDayInterval=; expirationDate=; expirationTemplateText=Expires every 365 day(s); jumpboxRouteSelection=}" to type | "Thycotic.PowerShell.Secrets.DetailSettings". Error: "Cannot convert the "@{sendEmailWhenViewed=False; sendEmailWhenChanged=False; sendEmailWhenHeartbeatFails=True; rdpLauncherSettings=; | sshLauncherSettings=; oneTimePasswordSettings=; expirationType=Template; expirationDayInterval=; expirationDate=; expirationTemplateText=Expires every 365 day(s); jumpboxRouteSelection=}" | value of type "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.Secrets.DetailSettings"." ### Provide a test case or steps to reproduce Running on both PS 5.1 and latest 7x build on Windows 10 ### Expected behavior To return data. ### What Edition of Secret Server? Professional ### What version of Secret Server 11.0 ### What PowerShell host was used when producing this error PowerShell Core (pwsh) ### PowerShell Host Version Name Value ---- ----- PSVersion 7.2.4 PSEdition Core GitCommitId 7.2.4 OS Microsoft Windows 10.0.19044 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0ΓǪ} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0
tylerezimmerman commented 2 years ago

This has been resolved in PR #295. This will be available in the next Powershell Gallery release.