Page 1 of 1

Event Source

Posted: Fri Oct 05, 2012 5:07 am
by biscuits
Hi,

We have an installer where we need to create the event source at install time. This is the only time we can guarentee administrator rights and I do this with standard deployment projects within Visual Studio with ease by overriding the Install method in the installer class.

Can you advise the best way to do this in InstallAware? Is creating an executable and including in the "Run Program" your only solution?

kind regards

Re: Event Source

Posted: Fri Oct 05, 2012 7:48 am
by FrancescoT
Dear User,

I'm not quite sure if I follow your question.

What do you exacly mean with, "We have an installer where we need to create the event source at install time"?

Regards

Re: Event Source

Posted: Fri Oct 05, 2012 8:50 am
by biscuits
Dear Francesco,

I have a product which needs to be installed both on Windows 7 and XP machines.

When an error occurs, I need to be able to write to the event viewer from my application. To do this I need an event source. The only time we have admin rights within Windows 7 is during the install process. This is where we need to create that event source.

How is this best done using InstallAware? Within .Net it would be...
System.Diagnostics.EventLog.CreateEventSource(source,logname)

Regards

Re: Event Source

Posted: Fri Oct 05, 2012 9:25 am
by bokkie
Hello Biscuits,

I understand what you want to do but I don't recall anything in IA that does it for you. In the MSIcode window look at the commands and plugins on the right of your screen. Scroll through them and if there is something you should be able to do it. If there isn't, you might want to create a dotnet app that writes to the event viewer for you. Perhaps create a console application and pass in arguments that identify the event source you want to write to and the message you want to write.

Then include your dotnet app as a support file which is only available at installation time and isn't installed. You can then run the command (there's a run command in IA) and let it do the work for you.

If there's a simpler way, Francesco will advise you. :)

Re: Event Source

Posted: Fri Oct 05, 2012 10:00 am
by FrancescoT
.... I can only confirm what Bokkie has very well explained.

Regards

Re: Event Source

Posted: Fri Oct 19, 2012 7:29 am
by biscuits
Thank you for the responses. We managed to do the following with the "Run Program" function in IA which seems to work, although not tested in all evironments yet...

Run Program : eventcreate
Hide Program Window : True
Command Line Parameters : /ID 1 /L APPLICATION /T INFORMATION /SO EventSourceName /D "Installed"
Wait For Program to Finish : True

This will log a new event, of type information when installing. As it is in admin mode at this time it creates the event source at the same time. The program eventcreate is a Windows one existing in both XP and Win7 therefore there is no need for a custom console application.

Re: Event Source

Posted: Fri Oct 19, 2012 1:46 pm
by bokkie
Thanks a lot biscuits. I didn't know about eventcreate but I'm pleased to read that it and the run command statement helped you achieve your objective. :)

Re: Event Source

Posted: Tue Oct 23, 2012 9:31 am
by Sheri_Steeves
Hello,

The way I've done this in the past is to extract the event source registry keys from my development box and add them as part of the install program by importing the .reg file.
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\eventlog\Application\Your Application Here]
"EventMessageFile"=hex(2):43,00,3a,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77, 00,73,00,5c,00,4d,00,69,00,63,00,72,00,6f,00,73,00,6f,00,66,00,74,00,2e,00, 4e,00,45,00,54,00,5c,00,46,00,72,00,61,00,6d,00,65,00,77,00,6f,00,72,00,6b, 00,5c,00,76,00,34,00,2e,00,30,00,2e,00,33,00,30,00,33,00,31,00,39,00,5c,00, 45,00,76,00,65,00,6e,00,74,00,4c,00,6f,00,67,00,4d,00,65,00,73,00,73,00,61, 00,67,00,65,00,73,00,2e,00,64,00,6c,00,6c,00,00,00
Sheri