Tip: Windows internals using wmi

Colin Brown cbrown at metservice.com
Sun Oct 5 16:41:15 EDT 2003


"MetalOne" <jcb at iteris.com> wrote in message
news:92c59a2c.0310031541.e8ddc48 at posting.google.com...
> Can WMI be used to change environment variables such as PATH.
> The Environment Variables Dialog in Windows is complete crap.
> I might like to write a new environment variable editor in Python.

----------------------------------------------------------------------------
---------------------------
Hi MetalOne

I am not an expert on wmi having only just chanced upon it myself. However
some quick browsing gives:

The documentation for Win32_Environment (Google Win32_Environment) says that
wmi returns registry
information but does not provide methods for changing them.

From: http://support.microsoft.com/default.aspx?scid=kb;en-us;Q322756#3f
Use Windows Management Instrumentation
Windows Management Instrumentation (WMI) is a component of the Microsoft
Windows operating system and is the Microsoft implementation of Web-Based
Enterprise Management (WBEM). WBEM is an industry initiative to develop a
standard technology for accessing management information in an enterprise
environment. You can use WMI to automate administrative tasks (such as
editing the registry) in an enterprise environment. You can use WMI in
scripting languages that have an engine on Windows and handle Microsoft
ActiveX objects. You can also use the WMI Command-Line utility (Wmic.exe) to
modify the Windows registry.

For additional information about WMI, visit the following Microsoft Web
site:
http://msdn.microsoft.com/library/en-us/wmisdk/wmi/wmi_start_page.asp

For additional information about the Wmic.exe, click the following article
number to view the article in the Microsoft Knowledge Base:
290216 A Description of the Windows Management Instrumentation Command-Line
Utility

Following down these links gets to:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/ht
ml/scripting06112002.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnclinic/ht
ml/scripting08132002.asp

These are well worth a look if you want to know what wmi is all about. Table
1 indicates that you use the "Registry provider"  wmi interface for
modifying registry settings. I do not know if the python wmi interface
supports this.

There is a utility for testing wmi:  run wbemtest


Colin Brown
PyNZ







More information about the Python-list mailing list