473,320 Members | 2,112 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 4097
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.