Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

155 lines
6.3 KiB

  1. Sample Commands:
  2. ================
  3. (1)wmic:root\cli>process get name
  4. Displays the name property of all the instances specified by process in the default
  5. (value) format.
  6. (2)wmic:root\cli>process get name,caption /value /all
  7. Displays the name,caption properties of all the instances specified by process in the table
  8. format.Here eventhough both the getswitches are specified which indicates two diff.formats
  9. it will take the last one.
  10. (3)wmic:root\cli>class win32_useraccount
  11. It will display the list of properties of all the instances of win32_useraccount.Eventhough
  12. there is no verb specified it will take default as GET.
  13. (4)wmic:root\cli>class win32_useraccount get /interactive
  14. It will report an error because /interactive and /nointeractive are not allowed with GET,LIST
  15. and ASSOC.
  16. (5)wmic:root\cli>path win32_process list
  17. It will report an error becuse list verb is not allowed with PATH and CLASS.
  18. (6)wmic:root\cli>useraccount list brief /translate:Basicxml
  19. It will list the properties of the alias useraccount and translate the return
  20. values using the translation table Basicxml.
  21. (7)wmic:root\cli>process call create notepad.exe
  22. It will create an instance of notepad.
  23. (8)wmic:root\cli>process call create notepad.exe /interactive
  24. Itwill ask for the user response to create a notepad and creates according to
  25. his response.
  26. (9)wmic:root\cli>/interactive process call create notepad.exe
  27. Itwill ask for the user response to create a notepad and creates according to
  28. his response.Here /interactive is global level, so it will wait for the user response
  29. for subsequent commands also.
  30. (10)wmic:root\cli>class win32_process assoc
  31. (11)wmic:root\cli>class win32_process set caption="gjkvc"
  32. Sets the caption property to "gjkvc" of the instances of the class win32_process.
  33. (12)wmic:root\cli>class win32_process set caption="gjkvc" /interactive
  34. It will ask for the user prompt before setting the property specified.If the user says
  35. 'y' then it will set the property otherwise it won't set the property.
  36. (13)wmic:root\cli>class removetest00 create "p=100"
  37. Creates an instance of class Removetest00 with the property p=100.
  38. (14)wmic:root\cli>path removetest00 where p=100 get
  39. Display the properties of the instance of class removetest00 which has the property p=100
  40. (15)wmic:root\cli>path removetest00 where p=100 delete
  41. Deletes the instance of the class removetest00 which has property p=100.
  42. (16)wmic:root\cli>class removetest00 delete
  43. Deletes the class removetest00.
  44. (17)wmic:root\cli>process where handle=0 get
  45. Display the properties of the instance which satisfies the where expression.
  46. (18)wmic:root\cli>process (0 "System Idle Process") get
  47. Display the properties of the instances which satisfies the alias parameters specified.
  48. (19)wmic:root\cli>process path win32_process get
  49. The path specified by path expression(win32_process) and the alias(process) matched,
  50. that's why it will display the list of properties of all the instances of process.
  51. (20)wmic:root\cli>process path win32_useraccount get
  52. Here the path specified by pathexpression (win32_useraccount) and the alias (process) doesn't
  53. match, then it will report an error.
  54. (21)wmic:root\cli>process path win32_process where handle=0 list
  55. The path specified by path expression(win32_process) and the alias(process) matched,
  56. that's why it will list the properties of all the instances of process.
  57. (22)wmic:root\cli>process path win32_process.handle where handle=0 list
  58. Here it will report an error because when where is specified the path expression
  59. should be classpathexpression.
  60. (23)wmic:root\cli>/namespace:\\root\default class netdiagnostics get
  61. It will connect to the namespace \\root\default and display the properties of the instances
  62. of the class netdiagnostics.
  63. (24)wmic:root\cli>process where handle=0 call create notepad.exe
  64. It will report an error because create method of the class win32_process is not valid
  65. at the instance level.
  66. (25)wmic:root\cli>/role:\\root\cimv2 process get
  67. It will change the role to \\root\cimv2 and try to execute the command.It will report an
  68. error because the class corresponding to alias(process) Microsoft_clialias is not there
  69. inthe \\root\cimv2 namespace.
  70. (26)wmic:root\cli>/role:junk process get
  71. It will report an error while executing the command, becuse the specified namespace is not
  72. valid.
  73. (27)wmic:root\cli>/node:vnraju,biplabm /user:"administrator" /password:"test2" proce
  74. ss get
  75. If both the machines have the same password, then it will display the properties of the
  76. instances of process.If any one machine has different password then it will report the
  77. error for that node and display the properties of the instances of the process for the
  78. other node.If both the systems have different password then it will report the error for
  79. both the nodes.
  80. (28)wmic:root\cli>/node:vnraju /user:"administrator"
  81. It will prompt for the password, if the user enters the correct password then it will
  82. connect to the node vnraju.
  83. More commands:
  84. =============
  85. 1.a)
  86. wmic:root\cli>share call create "", "", 5, abcd, "", "C:\rams", 0
  87. (CREATE A SHARE)
  88. FYI:
  89. Create parameters are as follows:
  90. a)Access(OBJECT)
  91. b)Description(STRING)
  92. c)MaximumAllowed(UINT32)
  93. d)Name(STRING)
  94. e)Password(STRING)
  95. f)Path(STRING)
  96. g)Type(UINT32)
  97. 1.b) path win32_service where name='w3svc' get /value
  98. (PATH and WHERE together)
  99. 2. process 0 "system idle process" get /value
  100. (PWhere without parenthesis)
  101. 3. process (0 "system idle process") get /value
  102. (PWhere with paranethesis)
  103. 4. process path win32_process where handle=0 get /value
  104. (<alias> with PATH and WHERE)
  105. 5. /namespace:"\\root\cli" path Microsoft_CliAlias.FriendlyName='UPS'
  106. delete
  107. (Deleting an instance)
  108. 6. /node:ram, vivek /user:administrator /password:enterthedragon service get /value
  109. (multiple nodes - GET)
  110. 7. /node:ram, vivek /user:administrator /password:enterthedragon process call create notepad.exe
  111. (multiple nodes - CALL)
  112. 8. /node:ram /user:administrator /password:enterthedragon CLASS REMOVETEST00 create p=1
  113. (creating an instance)
  114. ATTN: run the sample vbscript - resettodefault.vbs for creating the class REMOVETEST00
  115. 9. diskdrive rmdir "d:\\share\\test"
  116. (executing other command line utilities)