tags:

views:

50

answers:

2

So of course I'm new to Python and to programming in general... I am trying to get OS version information from the network. For now I only care about the windows machines.

using PyWin32 I can get some basic information, but it's not very reliable. This is an example of what I am doing right now: win32net.NetWkstaGetInfo(myip, 100)

However, it appears as though this would provide me with more appropriate information: platform.win32_ver()

I have no idea how get the info from a remote machine using this. I need to specify an IP or a range of IP's... I intend on using Google's ipaddr to get a list of network ranges to scan. I will eventually need to scan a large network for this info.

Can someone provide an example?

+1  A: 

A good way is to use WMI. The following links from Microsoft contain enough information to write code for your purposes:

The missing piece is how to do this in Python. For that, consult Tim Golden's site:

By the way, if you're OK with using a command line program and parsing the output, then I would suggest the PsTools available freely. In particular, psinfo can do what you want.

ars
will only work if you have access rights to the remote computers
leoluk
assume that I have at least "user" rights on a PC. 99.99% I should have admin rights. I will not have admin rights to any server, only to the PC's.
cwheeler33
still looking at and trying to understand WMI. Very promising!
cwheeler33
Does the WMI service need to be enabled for me to use this? If so, I cannot use this solution. There is a department where due to a specific application they had to disable the service.
cwheeler33
@Chris: unfortunately, it needs to be enabled.
ars
A: 

I had to use remote registry... HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion

ProductName, EditionID, CurrentVersion, CurrentBuild

cwheeler33