Example one:
Python uses the WMI module to obtain hardware information for the WINDOWNS system: Hard disk partitions, usage, memory size, CPU model, current running process, Self starter program and location, system version, and more.
Copy Code code as follows:
#!/usr/bin/env python
#-*-Coding:utf-8-*-
Import WMI
Import OS
Import Sys
Import Platform
Import time
Def sys_version ():
If you want to remotely start someone else's computer, the first thing you think of is to first run the client program on the remote computer and then create another server program on the local computer, restart the remote computer through direct communication between the two programs. This is of course a method. However, this is a little troublesome. If you only tell the administrator of the remote computer to log on to the account, you are not allowed to run a so-called client program on the r
If you are asked to implement a remote boot to someone else's computer, the first thing you might think of is to run a client program on a remote computer and then do a server-side program on the local computer to restart the remote computer with direct communication from these two programs. This is certainly a method. But that's a bit of a hassle. If you now only tell your remote computer's administrator's login account, and not allow you to run a so-called client program on a remote computer,
Copy Code code as follows:
' Hardware_info.vbs v1.1 By:fastslz
On Error Resume Next
Dim Wmi,ws,fso
Set WMI = GetObject ("winmgmts:{impersonationlevel=impersonate}!\\.\root\cimv2")
Set Coss = WMI. ExecQuery ("SELECT * from Win32_OperatingSystem")
For each OOS in Coss
OS X = oos.caption "" Oos.csdversion VbCrLf
Next
bbx= "———————————— motherboard in
This article mainly introduces two examples of how to use Python to obtain information about the windowns system, such as CPU, memory, and hard disk. the pythonwmi module can be used as a reference.
Example 1:
Python uses the WMI module to obtain the hardware information of the windowns system: hard disk partition, usage, memory size, CPU model, current running process, self-starting program and location, and system version.
The code is as follows:
Starting with Windows 2000, WMI (Windows Management Specification) is an important part of Windows System Management. WMIC is the abbreviation for Windows Management Instrumentation command-line, and it is not easy to access the WMI database or WMI namespace from the command line before WMIC appears. Today, WMIC extends system management to the command line, leve
Author: Water as smoke
Namespace LzmTW.uSystem.uWindows.Win32APIFriend Class ErrCollection04Private Collection as New Dictionary (of Integer, String)Private Shared Loader as ErrCollection04Private Shared Ginternalsyncobject as ObjectPrivate Sub New ()With Collection. ADD (4000, "WINS encountered an error while processing the command"). ADD (4001, "local WINS cannot be deleted"). ADD (4002, "file import operation failed"). ADD (4003, "backup operation failed.") Have you made a full backup before?
Why not use WMI? Because the execution is very slow, why not winreg? Because WinReg is inconvenient in terms of bulk acquisition and traversal of services, this method is usedThis method is executed with WMIC under the command lineGet Service Information# Coding=utf8 from Import = GetObject ("winmgmts:"= mywmi. InstancesOf ("win32_service" for in OBJS: PrintGet process Information# Coding=utf8 from Import = GetObject ("winmgmts:"= mywmi. Instan
WinXP, Win7, Win8
Copy codeThe Code is as follows: 'indicate the source for reprinting original content and referencing the core part of the code.
Hard disk read/write statistics. vbs
If (Lcase (Right (Wscript. FullName, 11) = "wscript.exe") Then
CreateObject ("WScript. shell "). run ("% Comspec %/C" Chr (34) "mode con cols = 52 lines = 22" " Title hard disk read/write statistics. vbs By: FastSLZ PCEVA Or BatHome cscript.exe // NoLogo " Chr (34) Wscript. scriptFullName Chr (34) Chr (34), 3
WQL is the query language in WMI, WQL's full name is WMI query Language, referred to as WQL, translated into Chinese as if it could be the Windows Management Specification query language. A friend who is familiar with the SQL language will feel that it is very similar to SQL.
WQL is actually very simple, it has the following characteristics:1. Each WQL statement must start with a select;2, after the Select
print Handler has been installed.3006 the specified print monitoring program has been installed.3007 the specified print monitor does not have the required functions.3008 the specified printer monitor is in use.3009 this operation request is not allowed when the printer has a job queue.3010 the request is successful. The change takes effect only when the system is restarted.3011 the request is successful. The change takes effect only when the service is restarted.3012 the printer cannot be foun
DHCP Client obtains an IP address that has been used online. The Local interface is disabled until the DHCP Client obtains a new address.4200 the WMI data provider cannot identify whether the sent GUID is valid.
4201 the WMI data provider cannot identify whether the incoming Instance name is valid.4202 the WMI data provider cannot identify whether the incoming d
backup database.
4,005 names do not exist in the WINS database.
4006 does not allow replication of an unassigned part.
4100 DHCP Client obtains an IP address that has been used on the Internet. The local interface will be disabled until the DHCP client can obtain a new address.
4200 The WMI data provider does not recognize the validity of the GUID that came.
4201 The WMI data provider does not recognize th
Winxp,win7,win8
Copy Code code as follows:
' Original content reprint, the reference code core part please indicate the source
Hard disk read and write statistics. vbs
If (Lcase right (wscript.fullname,11) = "Wscript.exe") Then
CreateObject ("Wscript.Shell"). Run ("%comspec%/C" AMP;CHR "mode con cols=52 lines=22" "title hard Drive read-write statistics. vbs BY:FASTSLZ PCEVA Or Batho Me cscript.exe//nologo "AMP;CHR (a) Wscript.scriptfullname chr (%) chr), 3:Set
Directory
1. Use Windows form powerstatus
2. Use WMI
3. Use the new local API in Windows Vista
Returned directory1. Use Windows form powerstatus
Advantages
. Net Original Ecology
Disadvantages
No Event Notification
The first method is to use the powerstatus attribute of systeminformation in Windows Forms to return a powerstatus object.
The batterychargestatus attribute can be used to obtain the batterychargestatus,
allows you to list all Group Policy objects that match conditions in the entire site by specifying the Group Policy Object Name, the Group Policy Object User Group, GUID, and other values of specific keywords in the project. I believe that the search function is the most attractive aspect for group policy administrators to use GPMC. Figure 8 shows a typical Search dialog box.
WMI Filter is also an attractive but powerful option. As we all know,
Some Windows Communication Foundation registry keys cannot be repaired by performing the MSI repair operation on. NET Framework 3.0.
If you delete any of the following registry keys:
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ servicemodelservice 3.0.0.0
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ servicemodeloperation 3.0.0.0
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ servicemodelendpoint 3.0.0.0
HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentContr
Can you quickly find the crux of Your. NET application performance problems? This is an issue that must be considered for an operating enterprise application. I have encountered many problems in my recent work. The running system is completely a Black Box. Unlike the products in developmentCodeWhen a problem occurs during debugging, a very important aspect of the operating system can be monitored without the support of the Operation and Maintenance System. NET application, it will be as fragile
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.