Description
Verified issue does not already exist?
No, I did not search
What error did you receive?
while executing Copy-dbadbmail -source $source -destination $source -force , ending up with error
Write-Message : Specified cast is not valid.
DEBUG: 7681 | [06:21:29][Copy-DbaDatabaseAccount] Migrating accounts.
Write-Message : Specified cast is not valid.
At line:7685 char:17
- ... Write-Message -Message "Updating account name from '$acco ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Message], InvalidCastException
- FullyQualifiedErrorId : System.InvalidCastException,Dataplat.Dbatools.Commands.WriteMessageCommand
DEBUG: 7749 | [06:21:38][Copy-DbaDbMailProfile] Migrating mail profiles.
Type Name Status Notes
Mail Account sqlaccount Failed
Write-Message : Specified cast is not valid.
At line:7736 char:25
- ... Write-Message -Level Verbose -Message "Issue copying mail ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Message], InvalidCastException
- FullyQualifiedErrorId : System.InvalidCastException,Dataplat.Dbatools.Commands.WriteMessageCommand
Mail Account sqlaccount Failed
Write-Message : Specified cast is not valid.
At line:7754 char:17
- ... Write-Message -Message "Updating profile name from '$prof ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Message], InvalidCastException
- FullyQualifiedErrorId : System.InvalidCastException,Dataplat.Dbatools.Commands.WriteMessageCommand
Mail Profile sqlaccount Failed
Write-Message : Specified cast is not valid.
At line:7808 char:25
- ... Write-Message -Level Verbose -Message "Issue copying mail ...
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- CategoryInfo : NotSpecified: (:) [Write-Message], InvalidCastException
- FullyQualifiedErrorId : System.InvalidCastException,Dataplat.Dbatools.Commands.WriteMessageCommand
Steps to Reproduce
# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference
Copy-DbaDbMail -Source $Source -Destination $Target -Force -debug
Please confirm that you are running the most recent version of dbatools
2.1.30
Other details or mentions
No response
What PowerShell host was used when producing this error
Windows PowerShell ISE (powershell_ise.exe), Windows PowerShell (powershell.exe)
PowerShell Host Version
Name Value
PSVersion 5.1.17763.7009
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.7009
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
SQL Server Edition and Build number
Source:
Microsoft SQL Server 2017 (RTM-CU31-GDR) (KB5046858) - 14.0.3485.1 (X64) Oct 17 2024 16:14:54 Copyright (C) 2017 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 (Build 9600: ) (Hypervisor)
Destination:
Microsoft SQL Server 2022 (RTM-CU18) (KB5050771) - 16.0.4185.3 (X64) Feb 28 2025 18:24:49 Copyright (C) 2022 Microsoft Corporation Standard Edition (64-bit) on Windows Server 2022 Standard 10.0 (Build 20348: ) (Hypervisor)
.NET Framework Version
.NET Framework 4.8.4775.0