dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

dbatools does not create config file when run noninteractively

Open DarenDaigle opened this issue 1 year ago • 1 comments

Verified issue does not already exist?

I have searched and found no existing issue

What error did you receive?

No, error, other than the continued message that I may configure the message settings.

I am running as a domain account in task scheduler and am not blocking profile loading.

Steps to Reproduce

Set-DbatoolsConfig -FullName sql.connection.trustcert -Value $true -Register
Set-DbatoolsConfig -FullName sql.connection.encrypt -Value $false -Register 
Set-DbatoolsConfig -Name Import.EncryptionMessageCheck -Value $false -PassThru | Register-DbatoolsConfig

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

2.04

Other details or mentions

This fails when run non-interactively

What PowerShell host was used when producing this error

Windows PowerShell (powershell.exe)

PowerShell Host Version

Name Value


PSVersion 5.1.17763.4720
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.4720
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

PSChildName Version


Client 4.7.03190 Full 4.7.03190 Client 4.0.0.0

DarenDaigle avatar Sep 05 '23 14:09 DarenDaigle

What are you expecting? The config is written to the registry, not a file. The target is: HKEY_CURRENT_USER\Software\Microsoft\WindowsPowerShell\dbatools\Config\Default

You can use Set-DbatoolsConfig -FullName <...> -Value <...> -PassThru | Register-DbatoolsConfig -Scope SystemDefault to set it in: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsPowerShell\dbatools\Config\Default But you have to update dbatools to get this working because of a bug that was fixed recently.

andreasjordan avatar Oct 08 '23 14:10 andreasjordan

Will close this now, but can reopen if needed.

andreasjordan avatar Jun 05 '24 15:06 andreasjordan