Windows PowerShell and Processes

 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"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值