Windows PowerShell and Processes
2012-03-16 13:10
351 查看
All the available cmdlets related to processes can be found by executing the following cmdlet:
Get-Command *process* -CommandType "cmdlet"
Get-Process
To get a list of processes running on the local computer, execute the following command:
Get-Process
To query all the properties or methods available in the Get-Process cmdlet:
Get-Process |Get-Member –MemberType properties
Get-Process |Get-Member –MemberType methods
To get information about priority, location of the executable, the CPU, and memory usage:
Get-Process –Name "sql*" | Format-List ProcessName, Id, BasePriority,PriorityClass, PriorityBoostEnabled, MachineName, Path, UserProcessorTime,PrivilegedProcessorTime, Threads, WorkingSetSize, PagedSystemMemorySize,PrivateMemorySize, VirtualMemorySize
To change the priority of the SQLAGENT.exe process just shown from Normal to High:
$sqlagent=Get-Process -ProcessName "SQLAgent"
$sqlagent | select BasePriority, PriorityClass
$sqlagent.PriorityClass="High"
$sqlagent | select BasePriority, PriorityClass
Stop-Process
To stop SQL Server–related processesusing Stop-Process by executing the following command:
Get-Process "SQL*" Stop-Process -ProcessName "SQL*" -Confirm
To kill the process by the unique process ID:
Get-Process -ProcessName sqlservr | Select-Object ID, ProcessName
Stop-Process 2308
To access the processes from a remote computer:
Get-Process -ComputerName "RemoteHostname"
Get-Command *process* -CommandType "cmdlet"
Get-Process
To get a list of processes running on the local computer, execute the following command:
Get-Process
To query all the properties or methods available in the Get-Process cmdlet:
Get-Process |Get-Member –MemberType properties
Get-Process |Get-Member –MemberType methods
To get information about priority, location of the executable, the CPU, and memory usage:
Get-Process –Name "sql*" | Format-List ProcessName, Id, BasePriority,PriorityClass, PriorityBoostEnabled, MachineName, Path, UserProcessorTime,PrivilegedProcessorTime, Threads, WorkingSetSize, PagedSystemMemorySize,PrivateMemorySize, VirtualMemorySize
To change the priority of the SQLAGENT.exe process just shown from Normal to High:
$sqlagent=Get-Process -ProcessName "SQLAgent"
$sqlagent | select BasePriority, PriorityClass
$sqlagent.PriorityClass="High"
$sqlagent | select BasePriority, PriorityClass
Stop-Process
To stop SQL Server–related processesusing Stop-Process by executing the following command:
Get-Process "SQL*" Stop-Process -ProcessName "SQL*" -Confirm
To kill the process by the unique process ID:
Get-Process -ProcessName sqlservr | Select-Object ID, ProcessName
Stop-Process 2308
To access the processes from a remote computer:
Get-Process -ComputerName "RemoteHostname"
相关文章推荐
- Jobs, Processes, Threads and Fibers (Windows)
- SharePoint 2013 Backup Farm Automatically With a Powershell and Windows Task Schedule
- Enable and Use Remote Commands in Windows PowerShell
- Scheduling R scripts and processes on Windows and Unix/Linux
- Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers
- Managing Processes and Threads in Windows Forms
- windows获取进程的微软的不错例子Taking a Snapshot and Viewing Processes
- SharePoint 2013 Backup Farm Automatically With a Powershell and Windows Task Schedule
- Windows PowerShell and Services
- ZZ - Mapping Pointers and Sharing Memory between Processes: Windows CE 5.0 vs. Windows Embedded CE 6.0
- SharePoint 2013 Backup Farm Automatically With a Powershell and Windows Task Schedule
- Display Loaded and Available Modules in Windows PowerShell
- Optimizing Data Access and Messaging - Idempotency for Windows Azure Message Queues
- Preparing for Application and Service Deployment - Windows Azure Development Deep Dive: Working Wi
- Powershell 5.1 脚本化配置 Windows 2016 & SQL Server 2016 无域 AlwaysOn AG
- windows shell - powershell
- iPhone and iPad JavaScript dialogs (alert, confirm, prompt) and windows
- HOWTO install and setup Android NDK for Windows(Android NDK 开发环境安装和配置)
- Sessions, Desktops and Windows Stations
- wchar_t string on Linux, OS X and Windows