Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Event Viewer - Alternate Account Credentials

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,38327
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Event Viewer - Alternate Account Credentials
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Event Viewer - Alternate Account Credentials - 10/4/2006 12:12:52 AM   
  takeda kozo

 

Posts: 83
Score: 0
Joined: 11/9/2005
Status: offline
Hi Guys, I am using the Shell object to run c:\windows\system32\eventvwr.msc /computer=REMOTEPC

This works fine, and it opens event viewer (connected to the remote PC) but as I have not used an account with local admin rights on the remote PC, i am unable to view the security log

Is there anyway to run eventvwr.msc with alternate credentials ?



 
 
Post #: 1
 
 RE: Event Viewer - Alternate Account Credentials - 10/4/2006 1:30:43 AM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
have you tried c:\windows\system32\eventvwr.msc /computer=REMOTEPC user:username password

(in reply to takeda kozo)
 
 
Post #: 2
 
 RE: Event Viewer - Alternate Account Credentials - 10/4/2006 4:35:38 AM   
  ginolard


Posts: 1082
Score: 21
Joined: 8/10/2005
Status: offline
Or even using WMI to read the events.  Although, if I remember rightly, that's bloody slow.

_____________________________

Author of ManagePC - http://managepc.net
AD Query Template - http://www.visualbasicscript.com/m_40609/tm.htm
Consolidated Scripting Framework - http://www.visualbasicscript.com/m_59109/tm.htm

(in reply to gdewrance)
 
 
Post #: 3
 
 RE: Event Viewer - Alternate Account Credentials - 10/4/2006 4:38:31 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
speed depends on:

1) local LAN speed
2) log size
3) and ofcourse PC Hardware config...

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to ginolard)
 
 
Post #: 4
 
 RE: Event Viewer - Alternate Account Credentials - 10/4/2006 11:33:05 AM   
  takeda kozo

 

Posts: 83
Score: 0
Joined: 11/9/2005
Status: offline
quote:

ORIGINAL: gdewrance

have you tried c:\windows\system32\eventvwr.msc /computer=REMOTEPC user:username password



thanks anyway, but thats not a valid command line parameter :(

I've tried this from the command line:

runas /user:DOMAIN\Administrator "c:\windows\system32\eventvwr.msc /computer=""REMOTEPC"""

but i get the error ==> 193: c:\windows\system32\eventvwr.msc /computer="REMOTEPC" is not a valid Win32 application.

Which is strange, because if I use this command ==> c:\windows\system32\eventvwr.msc /computer="REMOTEPC"

Then it works fine (but without access to the security log.... as previously mentioned)

Hrmmmmm....

T_T

(in reply to gdewrance)
 
 
Post #: 5
 
 RE: Event Viewer - Alternate Account Credentials - 10/4/2006 5:12:56 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
I tried it and works on my network.
I also tried %sytemroot%\system32\eventvwr.msc /computer=PC user:administrator
I tried your way and had the same error.193

(in reply to takeda kozo)
 
 
Post #: 6
 
 RE: Event Viewer - Alternate Account Credentials - 10/4/2006 5:51:04 PM   
  takeda kozo

 

Posts: 83
Score: 0
Joined: 11/9/2005
Status: offline
I just used the same logic as for browsing the c$ share (my other post yesterday)

..............


'===============================

Sub Authenticate

Machine = "XXX"
strAdminUser = "YYY"
strAdminPass = "ZZZ"

ReturnCode = oShell.Run("net use \\" & Machine & "\c$ " & strAdminPass & " /user:" & strAdminUser,,True)

If ReturnCode = 2 Then
    Remote_Access_Granted = 0
ElseIf ReturnCode = 0 Then
    Remote_Access_Granted = 1
    Last_Connected_Machine = Machine
End If

If Remote_Access_Granted = 1

  strConnect_EventVwr = "oShell.Run(""c:\windows\system32\eventvwr.msc /computer=" & Machine & """)" 
  Execute strConnect_EventVwr 

End If

End Sub

(in reply to gdewrance)
 
 
Post #: 7
 
 RE: Event Viewer - Alternate Account Credentials - 10/4/2006 6:07:09 PM   
  gdewrance


Posts: 587
Score: 3
Joined: 3/16/2006
Status: offline
Nice work. They both work well. I made them to run on there own.

Dim oShell                                                      'added this
Set oShell = CreateObject("WScript.Shell") 'added this

Machine = "MachineName"
strAdminUser = "Administrator"
strAdminPass = "Password"

ReturnCode = oShell.Run("net use \\" & Machine & "\c$ " & strAdminPass & " /user:" & strAdminUser,0,True)     'Added the 0 to hide the DOS box

If ReturnCode = 2 Then
   Remote_Access_Granted = 0
ElseIf ReturnCode = 0 Then
   Remote_Access_Granted = 1
   Last_Connected_Machine = Machine
End If

If Remote_Access_Granted = 1 Then             'You missed this Then in your original code

strConnect_EventVwr = "oShell.Run(""c:\windows\system32\eventvwr.msc /computer=" & Machine & """)"
Execute strConnect_EventVwr

End If

(in reply to takeda kozo)
 
 
Post #: 8
 
 RE: Event Viewer - Alternate Account Credentials - 10/5/2006 1:04:13 AM   
  takeda kozo

 

Posts: 83
Score: 0
Joined: 11/9/2005
Status: offline
If anyone's curious why I posted subs.....then it was because I pulled this code from a HTA i've been working on

I didn't miss the "then" in my HTA ..... just when I was doing the cut and paste across to here ;)

but thanks anyway, glad you could get some use out of it

:D


(in reply to gdewrance)
 
 
Post #: 9
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Event Viewer - Alternate Account Credentials Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts