1 / 5

Windows Management Instrumentation (WMI)

Windows Management Instrumentation (WMI). Abbas Al Ali 441 Ali Al Mohana 448 Murtadah Al Nasser 459 Ammar Al Abdullwahab 463 Mohammed Al Dokhi 468. Windows Management Instrumentation (WMI).

bary
Download Presentation

Windows Management Instrumentation (WMI)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Windows Management Instrumentation (WMI) Abbas Al Ali 441 Ali Al Mohana 448 Murtadah Al Nasser 459 Ammar Al Abdullwahab 463 Mohammed Al Dokhi 468

  2. Windows Management Instrumentation (WMI) • WMI (Windows Management Instrumentation) commands? “Here are the people who I had in mind as I wrote this section. Network managers who want to collect specific data from one (or more) server. IT professionals who what to know precisely what's happening in their Microsoft operating system. Those techies who love remote control without hassle”. • http://www.computerperformance.co.uk/vbscript/wmi.htm (accessed on 14th of April)

  3. Example 1: process termination • WMI Script to Terminate a Process on the Local Machine • ' ProcessKillLocal.vbs' Sample VBScript to kill a program' Author Guy Thomas http://computerperformance.co.uk/' Version 2.7 - December 2010' ------------------------ -------------------------------' Option ExplicitDim objWMIService, objProcess, colProcessDim strComputer, strProcessKillstrComputer = "."strProcessKill = "'calc.exe'" Set objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2") Set colProcess = objWMIService.ExecQuery _("Select * from Win32_Process Where Name = " & strProcessKill )For Each objProcess in colProcessobjProcess.Terminate()Next WSCript.Echo "Just killed process " & strProcessKill _& " on " & strComputerWScript.Quit' End of WMI Example of a Kill Process

  4. Example 2: process termination • WMI Script to Terminate a Process on a Distant Machine • ' ProcessKillRemote.vbs' Sample VBScript kill process' Author Guy Thomas http://computerperformance.co.uk/' Version 2.9 - December 2010' ------------------------ -------------------------------' Option ExplicitDim objWMIService, objProcess, colProcessDim strComputer, strProcessKill, strInputstrProcessKill = "'calc.exe'" ' Input Box to get name of machine to run the processDo strComputer = (InputBox(" ComputerName to Run Script",_"Computer Name"))If strComputer <> "" ThenstrInput = TrueEnd ifLoop until strInput = TrueSet objWMIService = GetObject("winmgmts:" _& "{impersonationLevel=impersonate}!\\" _ & strComputer & "\root\cimv2")Set colProcess = objWMIService.ExecQuery _("Select * from Win32_Process Where Name = " & strProcessKill )For Each objProcess in colProcessobjProcess.Terminate()NextWSCript.Echo "Just killed process " & strProcessKill _& " on " & strComputerWScript.Quit' End of WMI Example of a Kill Process

  5. Summary • WMI • Example 1 • Example 2

More Related