Re: Creating a session in windows to auth to remote machines



ericwoodworth@xxxxxxxxx wrote:
Hi,
I'm trying to auth to remote machines so I can plunder WMI to get
logs and settings and the like. My script works for most of my
machines because they're all in the same domain and I run the script
as somebody who has enough access to get at this stuff but for
machines off the domain I'm stuck.

Unless I'm missing something here, you can already specify
username etc. with WMI. Just Dispatch on "WbemScripting.SWbemLocator"
and call .ConnectServer. Just in case you haven't already, I
(naturally :) ) recommend my wmi module [1] which wraps a fair bit
of the plumbing for you, including this. Eg,

<code>
import wmi

c = wmi.WMI ("some-machine", user="tim", password="password")

for log in c.Win32_NTLogEvent (
Logfile="Application",
Type="error"
):
print log.RecordNumber, log.SourceName, log.Message


</code>


[1] http://timgolden.me.uk/python/wmi.html

TJG
.



Relevant Pages

  • Re: How do I get the PCs Processor speed?
    ... We use a script here at work that runs whenever someone logs into ... their machine that logs various bits of information to a database. ... following registry key for the CPU info: ... I've also used Tim Golden's WMI module like so: ...
    (comp.lang.python)
  • Re: Find Default Network Card NIC
    ... the code is identical on the two machines. ... For information about WMI you can start from the Microsoft Script Center ... Where NetConnectionID '' ...
    (microsoft.public.scripting.vbscript)
  • Re: Find Default Network Card NIC
    ... the code is identical on the two machines. ... Where can I look up all this useful WMI stuff? ... For information about WMI you can start from the Microsoft Script Center ...
    (microsoft.public.scripting.vbscript)
  • Re: Permissions to execute the script
    ... I am using a vbscript to query the WMI classes. ... The script uses the ... On some machines, this vbscript works fine but on some machines this ... winmgmt /clearadap ...
    (microsoft.public.scripting.vbscript)
  • Re: 80041021 error - GetObject stdRegProv
    ... On a very small number of machines I see this ... error code 80041021, with no further explanation. ... it references is the WMI GetObject where I grab the stdRegProv. ... But the script runs flawlessly on ...
    (microsoft.public.scripting.vbscript)