Asked by:

How to log setup.exe output

Question

How should I run SQL Server Setup.exe in powershell? I have tried Start-Process, but I have a hard time logging the output. I am using start-transcript to log the console output. Is there a way to force the setup.exe output to the
console to be logged in the transcript? Do I log setup.exe output to a file and then output it to the console?

All replies

SQL Server setup programs write verbose log files in a folder similar to "c:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log", with apparently separate folders here for each installation. There is an optional command line switch,
/INDICATEPROGESS, that specifies the verbose log is piped to the console. Perhaps using this will allow you to capture the verbose log output. For command line details for SQL Server 2008 R2, see this link:

Thanks. I was planning on copying the bootstrap setup file as well if there is an error. I have a cmd version of a SQL setup network install. It logs the simple output which will have a short error message if there is an error.
If there is an error, the verbose log files are copied to the share for later examination. In batch, I see a message that the setup started. I don't see this in powershell. If I don't use "-nonewwindow", I will see the message in the
new window. I don't know how to pipe this output to the original window to be catured in the start-transcript log file. Randy in Marin

I tried doing a test instance installed (only SQL) through cmd.exe and powershell.exe. I found no difference in behavior if 1. I use /INDICATEPROGRESS 2. Pipe the output to a file using '>' along with that switch 3. Don't use that switch

What version of SQL you are deploying? Also, lets dig more into the scenario so that I can reproduce the exact behavior.

Hi Ketan, I have an old cmd version that redirects to a tmp file and then reads the file to include it in the log and display. With powershell I was trying to go the next step and trying to get the output to the console while the transcript was logging.
I was hoping to see the output as it was generated rather than waiting for setup to exit - setup can take a long time. I could not get it to do this by just running setup.

I ended up creating a process and using the events to get std and err output. More work, but I'm also able to output a dot every ten seconds so that there is something to watch when really bored. I'll post what I did when I get bact to the
office - I'm on vacation.

Hi Ketan, here is what I ended up doing. This is not the complete script, so it won't run as is. It is a lot of extra work to get output before setup.exe finishes. It would be a lot nicer if powershell was able to handle the setup.exe
output asynchronously within the same console window that setup.exe is executed. Or perhaps it can and I'm missing a bit or two.

I used a mutex at first to insure the events and loop did not collide, but I removed it because the event code seems to execute with the same thread. I probably should use a try-catch-finally for running the process to insure the events
are unregistered and the process is closed.

Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.