469,898 Members | 1,675 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

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 3918
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

30 posts views Thread by (Pete Cresswell) | last post: by
21 posts views Thread by Kevin Swanson | last post: by
29 posts views Thread by Patrick | last post: by
6 posts views Thread by Steve Teeples | last post: by
4 posts views Thread by PeterW | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.