Closed therealcode closed 5 years ago
You appear to be just providing usernames, you need to pass a PsCredential object:
$cred = Get-Credential
Test-DbaMaxMemory -SqlServer APP01 -Credential $cred
The above also doesn't work. It still returns the alternate domain as an error.
$cred = Get-Credential
(DOMAIN2\ADMIN_USER + PW on prompt)
Test-DbaMaxMemory -SqlServer APP01 -Credential $cred
WARNING: [13:41:54][Test-DbaMaxMemory] Failure | Login failed for user 'DOMAIN1\ADMIN_USER'.
After passing my original input - a pop-up opens to enter my password. I'm aware there's a workaround by saving the cred to a variable, but figured it would be nice if this method worked the same as Test-DbaPowerPlan (where entering the pass in the pop-up afterwards works fine).
prolly related to https://github.com/sqlcollaborative/dbatools/issues/1980 . for now, let's condider this still open.
this will work now 💯
Version: 0.9.384
Issue
When on DOMAIN1 and trying to use Test-DbaMaxMemory on a server on DOMAIN2 - the domain credentials supplied are ignored and it uses the domain credentials the PS session is on.
However, this works fine when using Test-DbaPowerPlan.
Reproducible Example
Example from PS Session on DOMAIN1: PS:
Test-DbaMaxMemory -SqlServer APP01 -Credential DOMAIN2\ADMIN_USER
or PS:Test-DbaMaxMemory -SqlServer APP01 -Credential ADMIN_USER@DOMAIN2.local
Expected Behavior
Actual Behavior
Error Returned - Regardless of which line in example was used:
"Exception calling "Open" with "0" argument(s): "Login failed for user 'DOMAIN1\ADMIN_USER'."" WARNING: [15:25:37][Test-DbaMaxMemory] Failure | Login failed for user 'DOMAIN1\ADMIN_USER'.
It shouldn't be sending DOMAIN1\ADMIN_USER when parameter specified is DOMAIN2\ADMIN_USER.
Environmental data