dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer
https://dbatools.io
MIT License
2.39k stars 787 forks source link

Cannot open database "abc" requested by the login. #9329

Closed scottfoulk closed 2 months ago

scottfoulk commented 2 months ago

Verified issue does not already exist?

No, I did not search

What error did you receive?

Cannot open database "abc" requested by the login. That seems to be literal and I dont have a database called abc. However if I create a database called abc i can sign in. My default database on every server is master.

Steps to Reproduce

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

Get-DbaDbOrphanUser All commands

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

2.1.5

Other details or mentions

This is for every dbatools command

What PowerShell host was used when producing this error

PowerShell Core (pwsh.exe)

PowerShell Host Version

Name Value


PSVersion 7.4.2 PSEdition Core GitCommitId 7.4.2 OS Microsoft Windows 10.0.22621 Platform Win32NT PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1 WSManStackVersion 3.0

SQL Server Edition and Build number

2016, 2019, and 2022

.NET Framework Version

.NET 8.0.4

potatoqualitee commented 2 months ago

hey @scottfoulk -- sounds like your config is messed up. Try Get-DbatoolsConfig | Reset-DbatoolsConfig or check your $PSDefaultParameterValues by typing $PSDefaultParameterValues at the console and see if you set any defaults.

I checked our codebase and we have examples that use abc but nothing in actual code.

scottfoulk commented 2 months ago

that was it been fighting this for weeks thank you.

potatoqualitee commented 2 months ago

great! which one, default params or config?