wmi - python script to collect the hostname of remote windows server -


i have python 2.7 installed on windows 7 machine.i wrote script connect remote windows server , worked fine. want execute command on remote server , collect hostname. know how collect local machine details how collect remote machine info?? appreciated. here's script

c = wmi.wmi(self.ip, user=self.username, password=self.password)

getting os_info remote machine:

import wmi

"" "hostname=remote server ip or domain name"""

conn=wmi.wmi(hostname,user=username,password=password)

for os in conn.win32_operatingsystem():

  print os 

note:make sure machine connected server domain or workgroup

[below links best tutorial wmi]

< http://timgolden.me.uk/python/wmi/cookbook.html>

http://coreygoldberg.blogspot.in/2008/12/python-monitor-windows-remotely-with.html


Comments