CFexecute, cfx_consolecommand dos/bat file error

Good day all. i have a really confussing problem... Let me
break it down
I have written an application that requires barcodes. My
Printer is a PPLB printer (not really important). So i create a
file on the server (This is about all that works fine).....
The printer is a network printer. so on the server i set up
the capture " net use LPT2
\\<machinename>\\<printersharename> /persistent:yes
(What the above does for those that do not know is set up a
vitual printer port so if you print to lpt2 it goes to the network
printer)
The command works perfectly..... Now the only thing i have to
do is send the file to the printer....
If im on the server and type "COPY /B c:\filetosend LPT2: "
note the Colon after LPT2 must be there it works perfectly.
But from anything else it doesnt..
What i have tried:
1) I tried running the command via cfexecute and
CFX_consolecommand which is available at
www.intrafoundation.com
that however does not work
2) Thinking i was smart i decided to write a bat file....
Easy. I wrote the file then used cfexecute and consolecommand to
run the file. With output enabled The error says "File Not Found"
This i have checked the file is there and LPT port is setup.
As i said if i type the command in command prompt it works
perfectly.
Now just to through another spanner in the works. if i run
the bat file from double clicking in windows or in command propt
type print.bat. (the name of the bat file i created) it works
perfectly..... Can someone explain this
So what i have determined is that:
1) When i type the command or run the bat file from command
prompt it works.
2) It does not work via cfexecute or commandconsole.
With some more testing If i leave the colon out after LPT2 it
says "0 Files Copied" so i think the colon is giving the problem...
Any help would be appreciated with this regard....
Another program maybe etc
Regards

ShapeShift,
Are you running the batch file or the dos command while
logged in as the
same user ColdFusion service is configured to run under? If
ColdFusion
is running under the default "Local System" account, try
turning on the
"Allow service to interact with the desktop" checkbox on the
"Log On"
tab for the ColdFusion service, or set the service to log in
with an
account you know has permissions to the remote printer.
HTH,
Carl
ShapeShift wrote:
> Good day all. i have a really confussing problem... Let
me break it down
>
> I have written an application that requires barcodes. My
Printer is a PPLB
> printer (not really important). So i create a file on
the server (This is about
> all that works fine).....
>
> The printer is a network printer. so on the server i set
up the capture " net
> use LPT2 \\<machinename>\\<printersharename>
/persistent:yes
>
> (What the above does for those that do not know is set
up a vitual printer
> port so if you print to lpt2 it goes to the network
printer)
> The command works perfectly..... Now the only thing i
have to do is send the
> file to the printer....
>
> If im on the server and type "COPY /B c:\filetosend
LPT2: " note the Colon
> after LPT2 must be there it works perfectly.
> But from anything else it doesnt..
>
> What i have tried:
> 1) I tried running the command via cfexecute and
CFX_consolecommand which is
> available at
http://www.intrafoundation.com
that however does not work
>
> 2) Thinking i was smart i decided to write a bat
file.... Easy. I wrote the
> file then used cfexecute and consolecommand to run the
file. With output
> enabled The error says "File Not Found" This i have
checked the file is there
> and LPT port is setup.
>
> As i said if i type the command in command prompt it
works perfectly.
>
> Now just to through another spanner in the works. if i
run the bat file from
> double clicking in windows or in command propt type
print.bat. (the name of the
> bat file i created) it works perfectly..... Can someone
explain this
>
> So what i have determined is that:
> 1) When i type the command or run the bat file from
command prompt it works.
> 2) It does not work via cfexecute or commandconsole.
>
> With some more testing If i leave the colon out after
LPT2 it says "0 Files
> Copied" so i think the colon is giving the problem...
>
> Any help would be appreciated with this regard....
> Another program maybe etc
>
> Regards
>
>
>

Similar Messages

  • Planning load utility via bat file - error

    I am using a bat file that uses the Planning load utility to make numerous updates to a single dimension on a test server. When I run the bat file i get an error that says the dimension is locked by another user. I am the only user with access to the test server. I've checked EAS and planning and nothing is locked. I've even shut down all hyperion services on the server and restarted them. It still says that the dimension is locked. How can I get this to unlock when I don't see where it is locked? This is a high priority situation! Any help is greatly appreciated!

    Thanks John - I think your scenario is what happened. Initially, when I ran the bat file, I got an error 'Java out of memory - java heap'. So I had to fix that and then I got the locked error. So you're saying that since it locked the dimension then erred, the lock was never able to be removed. I got it! Thanks so much! :) Jeri

  • OSCommand Bat File Error

    Hello
    I have a question on OSCommand, I am trying to run the .bat file using OSCommand but it is giving error, I am using the following
    OdiOSCommand "-COMMAND=E:\Hyperion\PlanningLoadFiles\LoadData\HRLoad.bat" "-OUT_FILE=E:\Hyperion\PlanningLoadFile\HRLOAD-OUT.txt" "-FILE_APPEND=YES" "-WORKING_DIR=E:\Hyperion\PlanningLoadFile"
    When I run the above command it gives the following error:
    java.io.IOException: CreateProcess: OdiOSCommand E:\Hyperion\PlanningLoadFile\HRLoad.bat error=2
    Please let me know what am I doing wrong?
    Thank you so much

    on what machine is the DEV agent installed ? the .bat file needs to be local to the machine on which the dev agent is installed.
    if you open a package, you will see a toolbar on which there are several ODI tools. 2 of them are OSCommand and OdiOSCommand.
    You mentioned that you are getting error with odiOSCommand. Did you try OSCommand ?

  • Apple (Unix) equivalent to a Windows "bat" file

    Good day,
    I have just solved a problem (thanks to someone on this forum) and written a small file to start the application.
    However, I wondering if there are some "simple" rules to write an equivalent of the Windows (DOS) bat file. I would like just to click on a file and let it run.
    Thanks.
    Kevin

    The DOS .BAT file was an attempt to bring to MS-DOS something like the idea of the UNIX script.
    In general, UNIX permits you to make a text file with commands in it and run it by simply flagging the text file as executable (rather than give it a specific suffix). This is how OS X does it. However, OS X adds the feature that if you give the file the suffix '.command', Finder will run Terminal.app to execute it (similar to how BAT files work in Windows).
    Unlike MS-DOS, however, UNIX (and OS X) permits you to specify what interpreter is used for the script. An interpreter is a program that reads in text from a file and does something with it. This is how languages like PERL and Python work.
    In UNIX, you can specify which interpreter to use by making the first line in the text file one that begins with '#!' followed by the path to the interpreter. For example, if your text file contains a script writtein the in the PERL language, it would look like this:
    #!/usr/bin/perl
    print "Hello World
    ... the UNIX shell is an intepreter too:
    #!/bin/sh
    echo Hello World
    For your script to run from the UNIX command line (Terminal.app), you need to set the executable flag of the file. For example, if your script is called 'myscript', then you'd type:
    chmod u+x myscript
    ... and you can execute it like so:
    ./myscript
    In fact, there are several different scripting languages provided with OS X for you to use: PERL, Python, Ruby, PHP, Bash, etc. Each has it's own strengths and complexities.

  • Execute bat file with cfexecute

    Hello,
    this is a newbie question but I'm stuck. I have a .bat that
    runs fine through the command prompt but won't run with
    <cfexecute>, it merely seems to read the .bat but not execute
    it. The .bat reads:
    java -classpath
    ".;C:\CFusionMX7\wwwroot\i-recall\javaClasses\GATE-3.1\bin\gate.jar"
    AnnieAPI
    When I run <cfexecute
    name="C:\CFusionMX7\wwwroot\i-recall\javaClasses\GateClasspathRun.bat"
    variable="myVar" timeout="100">
    </cfexecute>
    The output looks like this:
    C:\CFusionMX7\runtime\bin>java -classpath
    "C:\CFusionMX7\wwwroot\i-recall\javaClasses\GATE-3.1\bin\gate.jar"
    AnnieAPI
    It simply reads it and doesn't execute the java AnnieAPI
    command. I didn't write this .bat file so maybe I need to add
    something to make it run. Any help is appreciated.
    -Kalen G

    Same thing, just without the classpath in the output:
    C:\CFusionMX7\runtime\bin>java AnnieAPI
    Even if I remove the class path and simply leave java
    AnnieAPI it doesn't run. It should get an error message without the
    classpath or something but I don't And the page loads so quickly
    it's obvious that Coldfusion is just reading the code and not
    executing it.
    Thanks

  • Execute .bat file using cfexecute tag...

    Hello,
    I am trying to execute a batch file using cfexecute tag. This
    batch file needs 1 command line arguement, which I am passing using
    arguments
    Text attribute.
    When I run my batch file directly from command prompt, it
    works perfectly. but while using cfexecute, it doesn't seem to do
    anything.
    Note:- I am trying to encrypt a txt file using GPG algorithm
    in the batch file.
    Thanks in advance!
    Manju

    Hello,
    you have probally worked this out but if any of this helps :)
    I run an application that needs to print via dos command, so
    my cfm page makes a batch file writes some arguments to it then
    calls it with a cmd. the code is below if any of it helps im glad.
    (creates name for my bat file)
    <cfset BFname = '#namevariable#' & '.bat'>
    (sets up the text I need in the bat file)
    <cfset content = 'copy
    "c:\inetpub\wwwroot\mct\picklist.txt"
    \\MyPrintServer\ThePrinter'>
    (writes the bat file with the text in the content var)
    <cffile action="write"
    file="c:\inetpub\wwwroot\mct\#BFname#" output="#content#">
    (calls cmd to run the bat file)
    <cfexecute name="c:\windows\system32\cmd.exe"
    arguments="/c c:\inetpub\wwwroot\mct\#BFname#"
    outputfile="c:\inetpub\wwwroot\mct\log_output.txt"
    timeout="1"></cfexecute>
    Regards Guy

  • Cfexecute not executing CVS commands ina bat file

    We are running CF 7.0 on Windows server.
    I am creating a bat file containing both DOS commands and CVS
    commands.
    When executing the bat file via <CFexecute> the DOS
    commands execute, but the CVS commands do not.
    When running the bat file from the DOS command prompt, all
    commands (DOS and CVS) run as expected.
    Anyone have any ideas?
    Thanks

    On Wed, 24 Jan 2007 23:03:48 +0000 (UTC), JRoccaforte wrote:
    > That could be an issue. I am however using my login and
    password in the commands
    Ian didn't mean the CVS permissions, he meant the filesystem
    / OS
    permissions. The a/c that ColdFusion uses to access the file
    system and
    other system resources is very limited, by default.
    You need to login (to the OS) as the a/c CF is using, and see
    if you can
    execute your batch file.
    Adam

  • Getting error while running ua.bat file of Oracle Data Integrator 12cR1 (12.1.2.0.0) version

    Hi,
    I am using windows 7 professional(service pack 1) 64 bit operating system.
    After installing the odi 12c (enterprise edition) by executing the odi_121200.jar file I am getting the following error while trying to run the ua.bat file.
    [2013-10-24T16:49:07.861+05:30] [Framework] [INCIDENT_ERROR] [UPGAST-00056] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] error initializing upgrade plug-in for ODI.ODI1
    [2013-10-24T16:49:07.861+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] Cause: An unexpected error occurred initializing an upgrade plug-in.
    [2013-10-24T16:49:07.861+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] Action: Contact Oracle Support Services.  See the secondary error message for additional details.
    [2013-10-24T16:49:07.861+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] [[
    java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
      at oracle.ias.update.plugin.Plugin.instantiatePlugin(Plugin.java:248)
      at oracle.ias.update.plugin.Plugin.<init>(Plugin.java:229)
      at oracle.ias.update.plugin.Plugin.getPlugin(Plugin.java:180)
      at oracle.ias.update.plan.PlanStep.getPlugin(PlanStep.java:335)
      at oracle.ias.update.plan.PlanString.<init>(PlanString.java:66)
      at oracle.ias.update.plan.PlanCustom.<init>(PlanCustom.java:74)
      at oracle.ias.update.plan.PlanStep.<init>(PlanStep.java:189)
      at oracle.ias.update.plan.PlanComponent.<init>(PlanComponent.java:203)
      at oracle.ias.update.plan.Template.load(Template.java:161)
      at oracle.ias.update.plan.Template.loadAllTemplates(Template.java:102)
      at oracle.ias.update.UpgradeDriver.loadConfiguration(UpgradeDriver.java:838)
      at oracle.ias.update.UpgradeDriver.main(UpgradeDriver.java:257)
      at oracle.ias.update.UpgradeDriver.main(UpgradeDriver.java:175)
    Caused by: java.util.MissingResourceException: Can't find oracle.ias.update.plugin.odi.bundle.ODIResourceBundle bundle
      at java.util.logging.Logger.setupResourceInfo(Logger.java:1518)
      at java.util.logging.Logger.<init>(Logger.java:265)
      at java.util.logging.Logger.<init>(Logger.java:260)
      at oracle.ias.update.UpgradeLogger.<init>(UpgradeLogger.java:60)
      at oracle.ias.update.UpgradeLogger.getLogger(UpgradeLogger.java:93)
      at oracle.ias.update.LoggingManager.create(LoggingManager.java:249)
      at oracle.ias.update.plugin.UpgradePlugin.createPluginLogger(UpgradePlugin.java:195)
      at oracle.ias.update.plugin.UpgradePlugin.<init>(UpgradePlugin.java:181)
      at oracle.ias.update.plugin.odi.ODIPlugin.<init>(ODIPlugin.java:136)
      ... 17 more
    [2013-10-24T16:49:07.869+05:30] [Framework] [ERROR] [UPGAST-00259] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] The getInitialValue method for plug-in ODI.ODI1 will not be called due to a previous error.
    [2013-10-24T16:49:07.869+05:30] [Framework] [ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] Cause: An error occurred when loading or initializing the plug-in which prevents the getInitialValue method from executing.
    [2013-10-24T16:49:07.869+05:30] [Framework] [ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] Action: Review the log file for additional details.
    [2013-10-24T16:49:07.870+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] UPGAST-00251: An error occured reading Upgrade Descriptor file ODI\INSTALLATION\odi12cInstallation_1\odi\plugins\upgrade\odi.xml
    [2013-10-24T16:49:07.870+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] The file does not conform to the expected syntax.
    [2013-10-24T16:49:07.870+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] See the secondary message for additional information. Contact Oracle Support.
    [2013-10-24T16:49:07.871+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] UPGAST-00259: The getInitialValue method for plug-in ODI.ODI1 will not be called due to a previous error.
    [2013-10-24T16:49:07.871+05:30] [Framework] [INCIDENT_ERROR] [] [upgrade.Framework] [tid: 1] [ecid: e9250ad8-50dc-45fe-83f5-5c01e7a7dcb4-00000001,0] [[
    oracle.ias.update.exception.UpgradeException: UPGAST-00259: The getInitialValue method for plug-in ODI.ODI1 will not be called due to a previous error.
      at oracle.ias.update.plugin.Plugin.getInitialValue(Plugin.java:317)
      at oracle.ias.update.plan.PlanString.<init>(PlanString.java:67)
      at oracle.ias.update.plan.PlanCustom.<init>(PlanCustom.java:74)
      at oracle.ias.update.plan.PlanStep.<init>(PlanStep.java:189)
      at oracle.ias.update.plan.PlanComponent.<init>(PlanComponent.java:203)
      at oracle.ias.update.plan.Template.load(Template.java:161)
      at oracle.ias.update.plan.Template.loadAllTemplates(Template.java:102)
      at oracle.ias.update.UpgradeDriver.loadConfiguration(UpgradeDriver.java:838)
      at oracle.ias.update.UpgradeDriver.main(UpgradeDriver.java:257)
      at oracle.ias.update.UpgradeDriver.main(UpgradeDriver.java:175)
    Thanks and Regards
    Sunil

    ok - I think I've got it figured.  Appears to be a known issue.  You need to apply patch p17073913_121200.
    I downloaded that and applied to my Linux version - then re-ran the UA.  This time the GUI started and so now I'm going through the upgrade steps.
    The patch is generic, so should work for your windows environment too.  Good luck.

  • Error when running a bat file

    Can someone tell me what this error means; "ORA-12560: TNS:protocol adapter error"
    I had Oracle XE on my Windows XP Pro SP3, but I also install the EE of Oracle which I haven't setup yet. Originally when I run this .bat file by double clicking on it, "setup_distran_database.bat", everything worked fine. But now, I am getting tghe above error. Not sure if it was because I installed Oracle EE.
    This is the .bat file:
    *@ECHO off*
    *:: Ayo Ojikutu*
    *:: Using Murach's Oracle SQL and PL/SQL*
    *:: and Mike Murach & Associates, Inc. example*
    *:: Nov 11, 2011*
    *:: Uses SQL*Plus utility to run the SQL scripts that create*
    *:: and populate the tables in the AP, OM, and EX schemas.*
    *:: If necessary, edit the username/password*
    sqlplus system/passwordhere @setup_distran_database*
    *:: Display a message about the log file*
    ECHO.
    ECHO For details, check the setup_distran_database.log file in the current directory.
    ECHO.
    *:: Display 'press any key to continue' message*
    PAUSE

    "ORA-12560: TNS:protocol adapter error"
    Not sure if it was because I installed Oracle EE.Most probably yes, Windows has the last installed product environment. Try setting XE environment before running sqlplus, something likeset ORACLE_SID=XE
    set ORACLE_HOME=<XE Oracle Home>
    set PATH=<XE Oracle Home\bin>;%PATH%
    sqlplus .....

  • Error while deployment BAT file

    When deployment BAT file i have an error with description "1" and Message ID "10006". Therefore bat file has been successfully executed on client computer.
    The customer asks reports of deployment so i can't show report with errors only))
    Can anybody give an advise with this situation?
    If answer is helpful, please mark as answer or hit the green arrow on the left.

    If you are using the application model, you can add return code 1 as a success in the
    Return Codes tab of the deployement type. If not you can catch the exit code 1 in your batch file and return a 0 instead.
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • Variable not set (error 91)/Error during import (error 102)/execut bat file

    We are on BO 11.5.0.0 and using the COM SDK with Visual Basic to run multiple reports (sometimes multiple flavors of the same report) through a bat file.
    If we run the reports single-threaded through the bat file, the reports run fine.  However, if multiple versions of the bat file start at approximately the same time, we get one of two errors:
    91 Object variable or With block variable not set
    102 Error during import document -
    Here's the part of the code with the problem:
    Dim BOapp As busobj.Application
    Dim receiveDoc As busobj.Document
    Set BOapp = New busobj.Application
    BOapp.Interactive = False
    BOapp.Logon strUser, strPass, strFromSystem, "Enterprise", False, False
    BOapp.Visible = False
    Set receiveDoc = BOapp.Documents.OpenFromEnterprise(strFromRep, strFromFolder, boFolder)
    receiveDoc.SaveAs (strDocumentPath & strFromRep & ".REP")
    Values for the following variables are passed in from the bat file:
    strUser
    strPass
    strFromSystem
    strFromRep
    strFromFolder
    strDocumentPath
    If it fails on the OpenFromEnterprise statement, we get the 102 error.
    If it fails on the SaveAs statement, we get the 91 error.
    Running it through debug hasn't helped, since we are running only one report.
    Any thoughts on what could be going wrong?
    Thanks in advance

    I have tried this running the VB code on my desktop (outside of the bat file) and nothing out of the ordinary occurs.  The VB code runs fine with only one occurrence.
    I had seen on other posts "ThisDocument" and didn't know if it would be applicable in this situation.  I also wasn't sure how it should be used based on the rest of my code.  Would "ThisDocument" make a difference?
    Thanks again

  • How do I stop ODI if my DOS BATCH file flags an error?

    I have a DOS batch file as the first step in my ODI package. How do I send a code to ODI to tell it that it has failed and to stop processing the rest of the package? I was told I could use an ODI variable to accomplish this but not sure how.
    Also, how do I pass a semaphore/flag an error in my DOS batch file to ODI ?
    Thanks in advance for your help.
    I tried to search for this info in John's blog: http://john-goodwin.blogspot.com/search?q=error
    but was not able to find it.
    :)

    In your package 1st step is OS Command then some other steps involved, right ?
    In that case you can have your package like this
    OS Command (first step) ---------OK--------------> 2nd step -------------------> 3rd step
    So your 2nd step will run only when the 1st step is successful, it will not start 2nd step as 1st itself has failed .
    Thanks,
    Sutirtha

  • Error - executing oraclexmlsqlload.bat file

    Hi,
    I have downloaded XML SQL Utility.
    I have set the path(JDK path and oracle xml sql utility path) in env.bat file. Now when I try to execute oraclexmlsqlload.bat file, it is getting executed to a point where it says "creating function" and then I get this error...
    ORA-12203: TNS:unable to connect to destination.
    can any one advice me on this error pls.
    I have JDK setup right and JDBC is able to connect to the database.
    Thanks in advance.
    vik
    null

    If you are using the application model, you can add return code 1 as a success in the
    Return Codes tab of the deployement type. If not you can catch the exit code 1 in your batch file and return a 0 instead.
    My Blog: http://www.petervanderwoude.nl/
    Follow me on twitter: pvanderwoude

  • Error when trying to run the rcu.bat file as part of OBIEE 11g installation

    when trying to run the rcu.bat file as part of OBIEE 11g installation on windows 7 64 bit I am getting the following error
    "windows cannot find C:\Users\manoj\Desktop\Oracle.Make sure you typed the name correctly, and then try again".
    Please help me how to overcome this error, I am not able to understand why it is looking for C:\Users\manoj\Desktop\Oracle.
    Thanks
    Manoj

    after setting the ORACLE_HOME and Path environment variables also....I am still getting the same error...so is it like RCU can be run only on windows 7 32-bit machines and it does not work on 64-bit machines? and also it seems like the previous versions of OBIEE 10.1.3.X does not support windows 7 64-bit machines...
    please help me finding a solution to this error....
    and what are all the versions of OBIEE can be installed on windows 7 64-bit machines?
    can't we install OBIEE 11g on windows 7 64-bit machines without including RCU?
    thanks
    Manoj
    Edited by: mkumar on Jun 2, 2011 3:47 AM

  • Batch Code to trigger bat file whenever there is an error in Eventvwr log error

    Batch Code to trigger bat file whenever there is an error in Eventvwr log error

    Hello,
    You can create a windows service which can look into EventVwr and update you accordingly
    Sample code:
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    namespace EventViewer
        class Program
            static void Main(string[] args)
                //logType can be Application, Security, System or any other Custom Log.
                string logType = "Application";
                EventLog ev = new EventLog(logType, System.Environment.MachineName);
                int LastLogToShow = ev.Entries.Count;
                if (LastLogToShow <= 0)
                    Console.WriteLine("No Event Logs in the Log :" + logType);
                // Read the last 2 records in the specified log.
                int i;
                for (i = ev.Entries.Count - 1; i >= LastLogToShow - 10; i--)
                    EventLogEntry CurrentEntry = ev.Entries[i];
                    Console.WriteLine("Event ID : " + CurrentEntry.EventID);
                    Console.WriteLine("Entry Type : " + CurrentEntry.EntryType.ToString());
                    Console.WriteLine("Message :  " + CurrentEntry.Message + "\n");
                    Console.ReadKey();
                ev.Close();
    Alternative way is to use below link
    http://blogs.technet.com/b/jhoward/archive/2010/06/16/getting-event-log-contents-by-email-on-an-event-log-trigger.aspx
    Thanks
    Abhishek

Maybe you are looking for

  • Trouble connecting wirelessly via Verizon FiOS router

    I am using a Titanium G4 Powerbook, OS 10.4.11. I have an Airport Extreme connected to a Verizon FiOS router. These are set to broadcast on different channels. Our iMac is connected to the FiOS via Ethernet: no problem getting online. Other Mac noteb

  • Question on adding LUNs to disk group

    GI version :11.2.0.3.0 Platform : OEL I need to add 2TB to the following disk group. Each LUN is 100gb in size. 100gb x 20 = 2 Tera Byte. Which means I have to run 20 commands like below SQL> ALTER DISKGROUP DATA_DG1 ADD DISK '/dev/sdc1' rebalance po

  • Data from different systems in one report in Visual Composer

    Hi, I want to create a dashboard report in visual composer where in I have a set of 10 tables data to be displayed in one page out of 10 queries I am getting the data for 5 of the reports from Bi system and for other reports we get it from CRM system

  • . How to sync calender on mobileme

    Registered iphone 3g and ipad with mobileme, but please how to i get the calenders to sync automatically without going to itunes Thanks

  • Trying to update from desktop,to receive new updates...

    Not sure what the problem is... I already updated to CC 2014, but am seeing a notice for more updates and am getting the following ERROR CODE: "Creative Cloud desktop failed to update.(Error code: 2) Contact Customer Support"  Can't figure out why. t