Module for generic platform information: platform.py

Thomas Heller thomas.heller at ion-tof.com
Wed Oct 27 12:11:24 EDT 1999


> Thomas Heller wrote:
> > 
> > I searched the MSDN again,
> > it seems that winmsd.exe is included in NT 3.5, 3.51, 4.0
> > and installed by default.
> 
> Sound even better ;-) (It doesn't seem to exist on Win95, so I'll
> only use it for WinNT.)
> 
> What command string would I have to pass to os.popen to get the output
> (I only need the first few lines) without any windows popping up ?
> 
That's were the problem (mentioned earlier) start. This is windows here,
so do not expect for programs to write to stdout!

As I said before, winmsd writes its output to the file <hostname>.txt.
AFAIK, you cannot pipe the output somewhere else, nor can you change the
name of this file.

The following script demonstrates how to do it:

  import string, os, sys
  hostname = string.strip (os.popen ("hostname && winmsd /s /f").read())
  file = open (hostname + '.txt')
  for i in range (12):
    sys.stdout.write (file.readline())

The output on my system are:
  
    
    
  
  Microsoft Diagnostics Report For \\THOMASNOTEBOOK
  ----------------------------------------------------------------------
   
  OS Version Report
  ----------------------------------------------------------------------
  Microsoft (R) Windows NT (TM) Workstation
  Version 4.0 (Build 1381: Service Pack 4) x86 Uniprocessor Free
  Registered Owner: Thomas Heller, ION-TOF GmbH

BUT: Be prepared to receive this in other languages!
AND: winmsd displays a progress dialog window like this

+--------------------------+
| Generating WinMSD report |
|    +-------+             |
|    | Cancel|             |
+----+-------+-------------+

which closes automatically after the second or so, when the report
is complete. I did not find a way to suppress this window.
Hope this helps,

Thomas Heller






More information about the Python-list mailing list