vsamadi
Posts: 9
Joined: Mon Oct 05, 2020 5:35 pm

How can I log sql username and password inside log file?

Wed Jan 12, 2022 6:28 pm

How can I store database user name password inside log file? I want to log this information in order to help our support team in case of installation failures.

I should notice that we have no security concerns about username & password.

I've used below script to log user name password but it is not working? Other properties are passed well but username/password which defined in database connection information are not shown up in the log file.

Code: Select all

Function WriteToLog
Const MsgType = &H04000000
Set rec = Installer.CreateRecord(6)
rec.StringData(1) = CStr("MyLog Log Enabled!") & vbNewLine
rec.StringData(2) = "MyLog USERNAME_PROP:" & CStr(Session.Property("USERNAME_PROP")) & vbNewLine
rec.StringData(3) = "MyLog PASSWORD_PROP:" & CStr(Session.Property("PASSWORD_PROP")) & vbNewLine
rec.StringData(4) = "MyLog DB Server Name:" & CStr(Session.Property("SERVER_PROP")) & vbNewLine
rec.StringData(5) = "MyLog DATABASE Name:" & CStr(Session.Property("DATABASE_PROP")) & vbNewLine
rec.StringData(6) = "MyLog INTEGRATED_SECURITY:" & CStr(Session.Property("INTEGRATED_SECURITY")) & vbNewLine


Session.Message MsgType, rec
WriteToLog = 0
End Function

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: How can I log sql username and password inside log file?

Thu Jan 13, 2022 11:53 am

Hello,

By default, Windows Installer saves the properties value contained in your project to a log file generated by launching msiexec. You just need to create the log.

Please have a look on our How do I create an installation log? article.

Hope this helps! If you have any other questions, please don’t hesitate to contact us.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

vsamadi
Posts: 9
Joined: Mon Oct 05, 2020 5:35 pm

Re: How can I log sql username and password inside log file?

Fri Jan 14, 2022 1:29 pm

As it is mentioned I have no problem logging other properties. I have a problem logging username and password to connect database only, other properties are logged well and I know how to log information inside the log file.

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: How can I log sql username and password inside log file?

Fri Jan 14, 2022 1:39 pm

Hi,

As previously mentioned, all properties are stored in log by default by Windows Installer.

That means also the PASSWORD_PROP and USERNAME_PROP properties are stored.

Can you please verify again after enabling the logging?

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”