472,782 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,782 software developers and data experts.

Access Right for Perlscript to Read Windows EventLog Remotely

Joe
I am trying to read the EventLog of different servers on the network. If I
run the script in a command line, it works well. But when I try to put the
script into the Web server (IIS in Windows 2000) and run from a web browser,
it works with my local machine only. I have the following error when I try
to access any remote server:

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Can't get number of Eventlog records

I think it is a permission issue related to IIS. I have already given local
admin's right to the account for running applications in Web and logging on
to the web server (ISUR_web01 & IWAN_web01). Also, I changed the account
for starting up the Web server to a domain admin's account from a system
account. But still I cannot make it work.

Any help would be appreciated.

Joe


#=============================
use Win32::EventLog;

# put in server name; it works for local server,
# but not any remote machines, have to fix it.

my $servername = "\\server1";
$handle=Win32::EventLog->new("System", $servername")
or die "Can't open Application EventLog\n";
$handle->GetNumber($recs)
or die "Can't get number of EventLog records\n";
$handle->GetOldest($base)
or die "Can't get number of oldest EventLog record\n";

print "Content-type: text/html\n\n";
print "<HTML>\n<BODY>\n<H3>\n\n";

while ($x < $recs) {
$handle->Read(EVENTLOG_FORWARDS_READ|EVENTLOG_SEEK_READ,
$base+$x,
$hashRef)
or die "Can't read EventLog entry #$x\n";
if ($hashRef->{Source} eq "EventLog") {
Win32::EventLog::GetMessageText($hashRef);
print "Entry $x: $hashRef->{Message}<P>\n";
}
$x++;
}

print "</H3>\n</BODY></HTML>";
Jul 19 '05 #1
1 4064
Joe wrote:
I am trying to read the EventLog of different servers on the network. If I
run the script in a command line, it works well. But when I try to put the
script into the Web server (IIS in Windows 2000) and run from a web browser,
it works with my local machine only. I have the following error when I try
to access any remote server:

CGI Error
The specified CGI application misbehaved by not returning a complete set of
HTTP headers. The headers it did return are:
Can't get number of Eventlog records

I think it is a permission issue related to IIS. I have already given local
admin's right to the account for running applications in Web and logging on
to the web server (ISUR_web01 & IWAN_web01). Also, I changed the account
for starting up the Web server to a domain admin's account from a system
account. But still I cannot make it work.


You don't need to be admin to read a remote eventlog. The account the
script runs with only needs SeNetworkLogon privs on the machine it
should read the eventlog from (at least for the system and application
eventlog; the security eventlog is another thing). This account has to
be a domain account.

I assume the script is *not* running under the user you think it is.
Perhaps printing out the environment variable USERNAME from the script
will make this clearer (I guess this will be one of the local accounts
I???_web01 that have no right whatsoever on the target machines).

Anyway, this is not a Perl question. I would recommend joining a IIS
group.

[snipped code]

Thomas

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eric Caron | last post by:
Hi I try to create a windows service to read content of my database at each 60 minutes. I create my service, i put a timer and set it's interval to 600000. This work good. My problem is that...
30
by: (Pete Cresswell) | last post by:
Just fired it up to see what it looked like. They wanted me to "Activate" the product before the 50th use. Geeze, I paid my money....now they want me to jump through their hoops? Brings back...
21
by: Kevin Swanson | last post by:
I'm attempting some remote registry manipulation via C#. I've written a test app to simply grab a specified key from a specified hive on a specified machine. The call to OpenSubKey is throwing...
3
by: cjk | last post by:
Issue Our web application requires access to write to a custom event log, yet access is denied. This access is denied because we are using impersonation, and our end-users do not (should not) have...
29
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ...
4
by: LP | last post by:
Hi, My webservice is currently deployed on WIndows 2000 server and runs pretty fine. I am trying to run my webservice on a Windows 2003 server. My webservice tries to write to a eventlog. The...
4
by: Seok Bee | last post by:
Dear Experts, I have created a script to extract the Event Logs from the system into an excel sheet. The logs are separated into 2 worksheets (Application Log and System Log). After this excel...
6
by: Steve Teeples | last post by:
I have a piece of code (written is Visual Studio 2005) that is only reading the Security EventLog. On Windows XP Professiona/Home this code works just fine. int numberOfEntries =...
4
by: PeterW | last post by:
I have a Windows service that needs to get some values from a config file. I place the config file for the service in the System32 directory. I do not get the values using the usual...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.