Powershell Tutorial
Introduction to Powershell Managing History of Powershell Commands Cmdlet, Alias, Function and Module in Powershell PSDrive Profile in Windows Powershell Variable Management in Powershell Passing values to parameters from file Creating files and directories Basic File System commands Finding the patterns in files Unique command Replacing patterns in files Comparing objects Sorting objects Other object commands Getting members of an Object Managing processes Managing Jobs IO redirection Piping System Commands Network commands Service Commands WMI(Windows Management Instrumentation) CIM (Common Information Model) Formatting output exporting output XML processing Powershell Module Management Remote computer managementwmi commands in windows powershell
WMI stores information of the system in Win32 classes. Here is the list of some of the classes. Each of below classes has methods and properties defined by Microsoft.- Win32_Desktop
- Win32_Environment
- Win32_TimeZone
- Win32_Directory
- Win32_LogicalDisk
- Win32_ComputerSystem
- Win32_OperatingSystem
- Win32_SystemProcesses
- Win32_SystemServices
- Win32_SystemUsers
- Win32_Process
- Win32_Service
- Win32_ProcessStartup
- Win32_Registry
- Win32_ScheduledJob
- Win32_Account
- Win32_Group
- Win32_LogonSession
- Win32_SystemAccount
- Win32_UserAccount
> Get-WmiObject -Query “SELECT * FROM Win32_UserAccount”
Below command will display the list of all hard drives in the systems.
> Get-WmiObject -Query “SELECT * FROM Win32_LogicalDisk”
Below command will get all processes with name “chrome” and then invoke “Terminate” method on each process.
Get-WmiObject -Class Win32_Process -Filter “name=’chrome.exe'”|
Invoke-WmiMethod -Name Terminate
Web development and Automation testing
solutions delivered!!