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-TssDirectoryServiceSyncStatus fails to convert output to Thycotic.PowerShell.DirectoryServices.DomainSyncStatus object. #396

Open premstad opened 7 months ago

premstad commented 7 months ago

Verified issue does not already exist?

No

What error did you receive

InvalidArgument: C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.9\functions\directory-services\Get-TssDirectoryServiceSyncStatus.ps1:55 Line | 55 | … [Thycotic.PowerShell.DirectoryServices.SyncStatus]$restRe … | ~~~~~~~~~~~~~ | Cannot convert value "@{estimatedPercentComplete=0; startDateTime=2/16/2024 5:07:16 PM; endDateTime=2/16/2024 | 5:07:23 PM; nextSynchronizationDateTime=2/16/2024 6:07:23 PM; errorCount=0; domainStatus=System.Object[]}" to | type "Thycotic.PowerShell.DirectoryServices.SyncStatus". Error: "Cannot convert value "@{domainId=1; | newUsersCreated=0; newUsersCreatedAsDisabled=0; usersRemovedFromGroups=0; usersWithGroupMembershipChanges=177; | domainUsersUpdatedSinceLastSynchronization=0; disabledUsers=0; lastLogEntry=Created 0 users. Updated | memberships for 177 users. Removed membership for 0 users. Disabled 0 users. 0 users were created as | disabled. Re-enabled 0 users. }" to type "Thycotic.PowerShell.DirectoryServices.DomainSyncStatus". Error: | "Cannot convert the "@{domainId=1; newUsersCreated=0; newUsersCreatedAsDisabled=0; usersRemovedFromGroups=0; | usersWithGroupMembershipChanges=177; domainUsersUpdatedSinceLastSynchronization=0; disabledUsers=0; | lastLogEntry=Created 0 users. Updated memberships for 177 users. Removed membership for 0 users. Disabled 0 | users. 0 users were created as disabled. Re-enabled 0 users. }" value of type | "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.DirectoryServices.DomainSyncStatus".""

Please run the command using -Verbose

VERBOSE: Command invocation: Get-TssDirectoryServiceSyncStatus -TssSession:TssSessionObject -Verbose:True VERBOSE: Performing the operation GET https://arrow.secretservercloud.com/api/v1/directory-services/synchronization InvalidArgument: C:\Program Files\WindowsPowerShell\Modules\Thycotic.SecretServer\0.60.9\functions\directory-services\Get-TssDirectoryServiceSyncStatus.ps1:55 Line | 55 | … [Thycotic.PowerShell.DirectoryServices.SyncStatus]$restRe … | ~~~~~~~~~~~~~ | Cannot convert value "@{estimatedPercentComplete=0; startDateTime=2/16/2024 5:07:16 PM; endDateTime=2/16/2024 | 5:07:23 PM; nextSynchronizationDateTime=2/16/2024 6:07:23 PM; errorCount=0; domainStatus=System.Object[]}" to | type "Thycotic.PowerShell.DirectoryServices.SyncStatus". Error: "Cannot convert value "@{domainId=1; | newUsersCreated=0; newUsersCreatedAsDisabled=0; usersRemovedFromGroups=0; usersWithGroupMembershipChanges=177; | domainUsersUpdatedSinceLastSynchronization=0; disabledUsers=0; lastLogEntry=Created 0 users. Updated | memberships for 177 users. Removed membership for 0 users. Disabled 0 users. 0 users were created as | disabled. Re-enabled 0 users. }" to type "Thycotic.PowerShell.DirectoryServices.DomainSyncStatus". Error: | "Cannot convert the "@{domainId=1; newUsersCreated=0; newUsersCreatedAsDisabled=0; usersRemovedFromGroups=0; | usersWithGroupMembershipChanges=177; domainUsersUpdatedSinceLastSynchronization=0; disabledUsers=0; | lastLogEntry=Created 0 users. Updated memberships for 177 users. Removed membership for 0 users. Disabled 0 | users. 0 users were created as disabled. Re-enabled 0 users. }" value of type | "System.Management.Automation.PSCustomObject" to type "Thycotic.PowerShell.DirectoryServices.DomainSyncStatus".""

Provide a test case or steps to reproduce

1) Install either Thycotic.SecretServer module version 0.60.9 or 0.61.8 (verified an issue on both, the error is the same) 2) Run the following commands 3) Import-Module Thycotic.SecretServer 4) Get API token for your Admin user through SS portal 5) Save token in a variable, i.e. $Token = "the pasted token string from SS portal" 6) $SSsession = New-TssSession -SecretServer -AccessToken $Token 7) Get-TssDirectoryServiceSyncStatus -TssSession $SSsession

Expected behavior

For the command to run and return the synchronization status.

What Edition of Secret Server?

Platinum

What version of Secret Server

Secret Server Cloud

What PowerShell host was used when producing this error

PowerShell Core (pwsh)

PowerShell Host Version

Name Value


PSVersion 7.4.1 PSEdition Core GitCommitId 7.4.1 OS Microsoft Windows 10.0.17763 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 months ago

@premstad we will take a look at this issue.