dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

copy-dbalogin do not report a warning or error when an -login is not found

Open frodr1k opened this issue 2 years ago • 0 comments

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

When using copy-dbalogin and specifying "-login"-paramter while accidently typing a non existing Login. The command just runs through without any warnings or error.

Below of the exact output from commandline

PS C:\WINDOWS\system32> copy-dbalogin -Source serverXX-Destination serverYY -login failme PS C:\WINDOWS\system32>

When running it with -verbose

PS C:\WINDOWS\system32> copy-dbalogin -Source serverXX -Destination serverYY -login failme -Verbose VERBOSE: [11:25:17][Connect-DbaInstance] String is passed in, will build server object from instance object and other parameters, do some checks and then return the server object VERBOSE: [11:25:17][Connect-DbaInstance] authentication method is 'local integrated' VERBOSE: [11:25:17][Get-DbaLogin] Getting last login times PS C:\WINDOWS\system32>

It reports nothing, making unexperienced users it worked since no warning was threwn.

Steps to Reproduce

# provide your command(s) executed pertaining to dbatools
# please include variable values (redacted or fake if needed) for reference

copy-dbalogin -Source serverXX -Destination serverYY -login failme

Please confirm that you are running the most recent version of dbatools

2.1.5

Other details or mentions

I'm not sure if an error or a warning should be threwn here. But throwing at least a warning would be "quite" good. Throwing an error might be overzealous and can probably break some scripts.

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe), Windows PowerShell ISE (powershell_ise.exe), VS Code (terminal), VS Code (integrated terminal)

PowerShell Host Version

Name Value


PSVersion 5.1.19041.3570
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.19041.3570
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

SQL Server Edition and Build number

N/A

.NET Framework Version

N/A

frodr1k avatar Nov 10 '23 10:11 frodr1k