0

I need a .bat file using which I can access the application logs of a remote server. I am using the psloglist.exe tool from sysinternals. I run the following command from a command prompt and get the desired output :

C:\scripts>psloglist.exe -n 5 application ultrabac8 \\<servername>

The output for the comand is as follows :

PsLoglist v2.51 - local and remote event log viewer
Copyright (C) 2000-2004 Mark Russinovich
Sysinternals - www.sysinternals.com

Application log on \\<Server Name>:
[200471] UltraBac8
   Type:     INFORMATION
   Computer: <Server Name>
   Time:     8/29/2014 3:40:09 AM   ID:       3
All 2 Sets Completed Without Errors or Warnings.

I tried to create a batch file that would just allow us to enter the server name and then would execute the command :

@echo off
cls
set /p input="Enter Server Name : "
cls

echo.

echo ********%input%********
echo.
C:\scripts\psloglist\psloglist.exe  psloglist.exe -n 5 application  -o ultrabac8 \\%input%
echo. 
Pause

THe script above is not executing. I think it might be an issue with the syntax. Please help me in getting this corrected.

Thanks everyone in advance.

  • What kind of answer are you expecting here? I don't want to sound rude, but it sounds like you expect us to do all the work for you. Stack Overflow isn't the place for that. Show us your effort: show us what you've tried and where you got stuck, that will allow us to help you. If, however, you really are looking for someone to do the work for you, please just go to a job site and hire a programmer. – Nic Wortel Aug 29 '14 at 10:56
  • @Nic - I have updated the question. Request you to please go through it. I am have not done batch scripting much hence I am pretty much outta options and really dont know anything more apart from what I have posted. Hence need help. – user1549284 Aug 29 '14 at 11:24
  • Good! This question is much more useful. Can you define 'the script is not executing'? Does it return an error message? Or nothing at all? – Nic Wortel Aug 29 '14 at 11:48
  • Also, I'm not a batch expert, but what happens if you change `C:\scripts\psloglist\psloglist.exe psloglist.exe` to `C:\scripts\psloglist.exe`? – Nic Wortel Aug 29 '14 at 11:50

1 Answers1

0

nothing seems to be wrong here unless you have made some mistakes in the psloglist.exe path, which is corrected in the below script, based on the manual command you have given. If you are still receiving error, remove the @echo off and see where it is failing.

@echo off
cls
set /p input="Enter Server Name :"
cls

echo.

echo ********%input%********
echo.
C:\scripts\psloglist.exe -n 5 application  -o ultrabac8 \\%input%
echo. 
Pause

Cheers, G

gbabu
  • 1,088
  • 11
  • 15