6

I was wondering if you can write the following action in a batch command?

  1. eventvwr (open the event viewer)
  2. Menu Action > Connect to another computer
  3. Type in the name of the computer.
  4. Connect.

This would make my life just a few minutes/day more efficient ;-)

Update
As we've just upgraded to Windows 7 and I needed a new solution, it seems to be possible like this:

%windir%\system32\eventvwr.exe targethostname

jscott
  • 24,484
  • 8
  • 79
  • 100
Peter
  • 161
  • 2
  • 10

6 Answers6

6

For Windows 7 the command is eventvwr hostname

plr108
  • 129
  • 6
ilie
  • 61
  • 1
  • 1
3

That eventvwr actually means eventwvr.msc, which is not an executable file: it's a saved MMC console, and it gets opened by the main MMC executable, mmc.exe.

Unfortunately, this means you just can't pass it any command-line parameter, beside those that are understood by mmc.exe (which are very few, and totally unrelated to connecting to another computer).

An option you can explore is creating your own custom MMC, by launching an empty console (just run mmc.exe) and adding snap-ins to it, including some instances of the Event Viewer one connected to other computers; then you can save this console, and when you'll open it later it will already be configured to show you those remote event logs.

Massimo
  • 70,200
  • 57
  • 200
  • 323
2

Apparently I haven't been googling enough before asking this question.

The solution is this :

eventvwr.msc /computer=hostname

don't forget the .msc or it won't accept the parameter

You can immediately put this in a shortcut if you want, it seems to work great!

[Edit]
This only works for Windows XP!

Peter
  • 161
  • 2
  • 10
  • I didn't know about this one... but I just tried it, and it doesn't seem to work (at least on Windows 7). I've tried "eventvwr.msc hostname", "eventvwr.msc /computer=hostname", "mmc.exe eventvwr.msc hostname" and "mmc.exe eventvwr.msc /computer=hostname": none of them worked, they always connected to the local event logs. – Massimo Aug 25 '10 at 08:57
  • Works on XP and Server 2003 but sadly must agree that it doesn't work on Win7, although the target machine may be Win7. – John Gardeniers Aug 25 '10 at 10:50
  • I should have mentioned this earlier but my case was specifically for Windows XP. I can't find anything for Windows 7 either. – Peter Aug 27 '10 at 06:22
2

In Windows Versions greater than XP you can still use eventviewer.msc.

But the event viewer snap-in only accepts the colon and not the equal sign.

mmc eventvwr.msc /computer:hostname
Alex Berry
  • 2,307
  • 13
  • 23
user476862
  • 21
  • 1
  • Works very good. Do you know if I can pass a username and password which should be used for the connection? Or is there any documentation? I couldn't find any. – TheBrain Sep 09 '21 at 09:10
0

I finally got this working on Windows7. Don't ask me why, but this works. Set your "Target:" value to:

%windir%\system32\eventvwr.exe

i.e. %windir%\system32\eventvwr.exe johnnysLaptop.ad.com

The ".exe" extension seems to do something magical to the Event Viewer start-up process (aka MMC.exe).

Johnny

-2

This works on Windows 7. In a batch file or on the commandline you can use this:

start eventvwr computername 
Andrew Schulman
  • 8,811
  • 21
  • 32
  • 47