windows-nt/Source/XPSP1/NT/admin/wmi/wbem/tools/wmic/commands.txt

156 lines
6.2 KiB
Plaintext
Raw Normal View History

2020-09-26 03:20:57 -05:00
Sample Commands:
================
(1)wmic:root\cli>process get name
Displays the name property of all the instances specified by process in the default
(value) format.
(2)wmic:root\cli>process get name,caption /value /all
Displays the name,caption properties of all the instances specified by process in the table
format.Here eventhough both the getswitches are specified which indicates two diff.formats
it will take the last one.
(3)wmic:root\cli>class win32_useraccount
It will display the list of properties of all the instances of win32_useraccount.Eventhough
there is no verb specified it will take default as GET.
(4)wmic:root\cli>class win32_useraccount get /interactive
It will report an error because /interactive and /nointeractive are not allowed with GET,LIST
and ASSOC.
(5)wmic:root\cli>path win32_process list
It will report an error becuse list verb is not allowed with PATH and CLASS.
(6)wmic:root\cli>useraccount list brief /translate:Basicxml
It will list the properties of the alias useraccount and translate the return
values using the translation table Basicxml.
(7)wmic:root\cli>process call create notepad.exe
It will create an instance of notepad.
(8)wmic:root\cli>process call create notepad.exe /interactive
Itwill ask for the user response to create a notepad and creates according to
his response.
(9)wmic:root\cli>/interactive process call create notepad.exe
Itwill ask for the user response to create a notepad and creates according to
his response.Here /interactive is global level, so it will wait for the user response
for subsequent commands also.
(10)wmic:root\cli>class win32_process assoc
(11)wmic:root\cli>class win32_process set caption="gjkvc"
Sets the caption property to "gjkvc" of the instances of the class win32_process.
(12)wmic:root\cli>class win32_process set caption="gjkvc" /interactive
It will ask for the user prompt before setting the property specified.If the user says
'y' then it will set the property otherwise it won't set the property.
(13)wmic:root\cli>class removetest00 create "p=100"
Creates an instance of class Removetest00 with the property p=100.
(14)wmic:root\cli>path removetest00 where p=100 get
Display the properties of the instance of class removetest00 which has the property p=100
(15)wmic:root\cli>path removetest00 where p=100 delete
Deletes the instance of the class removetest00 which has property p=100.
(16)wmic:root\cli>class removetest00 delete
Deletes the class removetest00.
(17)wmic:root\cli>process where handle=0 get
Display the properties of the instance which satisfies the where expression.
(18)wmic:root\cli>process (0 "System Idle Process") get
Display the properties of the instances which satisfies the alias parameters specified.
(19)wmic:root\cli>process path win32_process get
The path specified by path expression(win32_process) and the alias(process) matched,
that's why it will display the list of properties of all the instances of process.
(20)wmic:root\cli>process path win32_useraccount get
Here the path specified by pathexpression (win32_useraccount) and the alias (process) doesn't
match, then it will report an error.
(21)wmic:root\cli>process path win32_process where handle=0 list
The path specified by path expression(win32_process) and the alias(process) matched,
that's why it will list the properties of all the instances of process.
(22)wmic:root\cli>process path win32_process.handle where handle=0 list
Here it will report an error because when where is specified the path expression
should be classpathexpression.
(23)wmic:root\cli>/namespace:\\root\default class netdiagnostics get
It will connect to the namespace \\root\default and display the properties of the instances
of the class netdiagnostics.
(24)wmic:root\cli>process where handle=0 call create notepad.exe
It will report an error because create method of the class win32_process is not valid
at the instance level.
(25)wmic:root\cli>/role:\\root\cimv2 process get
It will change the role to \\root\cimv2 and try to execute the command.It will report an
error because the class corresponding to alias(process) Microsoft_clialias is not there
inthe \\root\cimv2 namespace.
(26)wmic:root\cli>/role:junk process get
It will report an error while executing the command, becuse the specified namespace is not
valid.
(27)wmic:root\cli>/node:vnraju,biplabm /user:"administrator" /password:"test2" proce
ss get
If both the machines have the same password, then it will display the properties of the
instances of process.If any one machine has different password then it will report the
error for that node and display the properties of the instances of the process for the
other node.If both the systems have different password then it will report the error for
both the nodes.
(28)wmic:root\cli>/node:vnraju /user:"administrator"
It will prompt for the password, if the user enters the correct password then it will
connect to the node vnraju.
More commands:
=============
1.a)
wmic:root\cli>share call create "", "", 5, abcd, "", "C:\rams", 0
(CREATE A SHARE)
FYI:
Create parameters are as follows:
a)Access(OBJECT)
b)Description(STRING)
c)MaximumAllowed(UINT32)
d)Name(STRING)
e)Password(STRING)
f)Path(STRING)
g)Type(UINT32)
1.b) path win32_service where name='w3svc' get /value
(PATH and WHERE together)
2. process 0 "system idle process" get /value
(PWhere without parenthesis)
3. process (0 "system idle process") get /value
(PWhere with paranethesis)
4. process path win32_process where handle=0 get /value
(<alias> with PATH and WHERE)
5. /namespace:"\\root\cli" path Microsoft_CliAlias.FriendlyName='UPS'
delete
(Deleting an instance)
6. /node:ram, vivek /user:administrator /password:enterthedragon service get /value
(multiple nodes - GET)
7. /node:ram, vivek /user:administrator /password:enterthedragon process call create notepad.exe
(multiple nodes - CALL)
8. /node:ram /user:administrator /password:enterthedragon CLASS REMOVETEST00 create p=1
(creating an instance)
ATTN: run the sample vbscript - resettodefault.vbs for creating the class REMOVETEST00
9. diskdrive rmdir "d:\\share\\test"
(executing other command line utilities)