Académique Documents
Professionnel Documents
Culture Documents
to Managing Windows
Infrastructure from a
Command Line
Arkady Retik
Program Manager
Windows Server Division
Microsoft Corporation
Objectives
Agenda
Background
Architecture
Examples of use
Review
Advanced
Extending WMIC
Customizing WMIC
3
Why WMIC?
Customers
IT administrators
Non-programmers
User interface to WMI
Value
Cons
Remote Console
Cmd Line /
Simple scripting
WMIC
Remote GUI
Terminal Server
MMC
Web Admin
WMI Tools
Automated/preset
Policy
RIS
Automated setup
Para-programming/
Complex scripting
Admin focused
Pre-built .exe
Pre-built .vbs
Batch files
Redirection / Piping
WMIC adds extensibility
Simplicity
Top tasks covered with new command-line
tools
Admin focused, easy, and pre-built
Automation enhancements
Windows Management
Instrumentation (WMI)
Goals
Consistent methods
Consistent events
Consistent protocol
Consistent schema
Availability
Windows 95
Windows 98
Windows NT 4.0
Embedded NT
-------------------Windows 2000
Windows Me
Windows XP
Windows .NET Server
Partners (redistributed
w/ OEMs / ISVs / IHVs)
C:\>
Script
SWBEM
ODBC
Adapter
ODBC
Client
ADSI Ext.
Adapter
ADSI
Client
DCOM
WMI
WMICIM
CIMManagement
ManagementSchema
Schema
Schema RT
Schema
RT
/ /Provider
Provider
Subsystem
Subsystem
Query
Query
Service
Service
View
View
Service
Service
WMI
WMIServices
Services
Pub/Sub
Pub/Sub
Service
Service
DCOM
Event
Event
Filtering
Filtering
WMI Repository
Perf
Perf
Counters
Counters
Windows
Windows NT
NT
Event
Log
Event Log
WMI
WMI ext
ext
for
for WDM
WDM
SNMP
SNMP
Active
Active
Directory
Directory
10
wmic:root\cli>/?
12
WMIC Architecture
Alias
Alias
(FriendlyName
(FriendlyName))
Definitions
Definitions
Alias
Alias
Schema
Schema
(scripting/batch mode)
(interactive mode)
WMIC
Engine
Provider
Provider
Provider
Provider
Provider
WMI
WMI
Console
XML
XML
DOM
DOM
XSLT
XSLT
XSLT
XSLT
XSLT
XSLT
HTML
CSV
MOF
Customer defined
13
Principles
Driven by instrumentation
Uses common grammar
Provides transparent remoting
Aliases
Parser/engine
Transforms
14
WMIC Abilities
15
Scenarios
Telnet
16
WMIC in Enterprise
Management
Station
(Windows XP Professional
or. NET Server)
Network
Target 1
Target 3
(WMI Installed)
(MOM Server)
Target 2
(SMS Server)
17
18
19
20
21
22
Using Verbs
23
Using Formats
24
Remoting
25
Examples of Commands
QFE
PRODUCT or
Advanced Applications
28
Direct
DirectAccess:
Access:
PATH/CLASS
PATH/CLASS
commands
commands
Supporting Instrumentation
> PATH <ClassName> [verb] [properties] [format] query Instances of a Class
Example: > path win32_process get name, processid, handle
> /node:@list.txt path HardwareConfig call DriverUpdate
> CLASS <ClassName> [verb] [properties] [format] query Class properties
Example: > wmic class win32_share >ShareSchema.html
Provider
Provider
Provider
Any
AnyWMI
WMI
Schema
Schema
WMIC
Engine
Console
XML
XML
DOM
DOM
XSLT
XSLT
XSLT
XSLT
XSLT
XSLT
HTML
CSV
MOF
Customer defined
29
30
31
32
Automating WMIC
New
application
Example:
WMIC /NODE:@"c:\MyServerList.txt" SERVICE WHERE caption=
"SSDP Discovery Service" CALL ChangeStartMode "Disabled"
MyServerList.txt
Server1
Server1 Server6
Server6
Server2
Server7
Server2 Server7
Server3
Server3 Server8
Server8
Server4
Server9
Server4 Server9
Server5
Server5 .
.
.
.
.
.
.
.
.
.
Server1024
Server1024
33
Access files:
CliAliases.mof Alias class and namespace
definitions
CliEgAliases.mof Aliases instances
CliEgAliases.mfl Aliases localization
35
Examples of Customization
instance of MSFT_CliAlias
{
Connection =
.........................................
Description = "Basic input/output services (BIOS) management.";
Formats =
........................................................................
FriendlyName = "BIOS";
..................................................
Target = "Select * from Win32_BIOS";
};
instance of MSFT_LocalizablePropertyValue
{
RelPath = "MSFT_CliAlias.FriendlyName=\" BIOS\"";
PropertyName = "Description";
Text = {"Basic input/output services (BIOS) management."};
};
36
37
Xsl-mappings.xml
<XSLMAPPINGS>
<XSLFORMAT KEYWORD="TABLE">texttable.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="VALUE">textvalueList.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="LIST">textvalueList.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="RAWXML">rawxml.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="HTABLE">htable.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="HFORM">hform.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="HXML">xml.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="HMOF">mof.xsl</XSLFORMAT>
<XSLFORMAT KEYWORD="CSV">csv.xsl</XSLFORMAT>
</XSLMAPPINGS>
38
Reporting:
40