
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2039 Articles for Microsoft Technologies

4K+ Views
When you pipeline the parameter Get-Member (alias gm) and filter out properties then there will be two different properties that will be displayed. One is for the File and another is for the Folders.Get-ChildItem propertiesCommandGet-ChildItem | gm | where{$_.Membertype -eq "Property"}Output** Properties of Directory TypeName: System.IO.DirectoryInfo Name MemberType Definition ---- ---------- ---------- Attributes Property System.IO.FileAttributes Attributes {get;set;} CreationTime Property datetime CreationTime {get;set;} CreationTimeUtc Property datetime CreationTimeUtc {get;set;} Exists Property bool Exists {get;} Extension ... Read More

1K+ Views
Get-ChildItem (alias: dir) in Powershell is used to get the items inside the container. This container could be the Folders, Registry or the certificate store. You can retrieve items from one or more specified locations. This command works similar to the dir in command prompt but PowerShell provides a modern way to extract the data.

974 Views
After killing the process using Stop-Process command in PowerShell, you can determine if the process is really terminated from the system with HasExited function.For example, we will kill Notepad process and check if Notepad process still exists in the system?$notepad = Get-Process notepad | Stop-Process if($notepad.HasExited){"Process is terminated"} else{"Process is still running"}

3K+ Views
With the Passthru parameter, PowerShell returns the output in the console. For example, below notepad.exe process with ID 12344 will be stopped and the same will be displayed in the console with the Passthru parameter. Earlier it was not the case with only Stop-Process.PS C:\WINDOWS\system32> Stop-Process -Id 12344 -PassThru Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 227 13 2800 13440 0.19 12344 1 ... Read More

313 Views
To get the consent from the user before stopping process or instance, -confirm parameter is used.ExampleIn the below example, we will stop notepad.exe process with –Id 4900 using –Confirm parameter.PS C:\WINDOWS\system32> Stop-Process -Id 4900 -Confirm Confirm Are you sure you want to perform this action? Performing the operation "Stop-Process" on target "notepad (4900)". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):Similarly, you can use the –Confirm parameter for stopping the process with Name.PS C:\WINDOWS\system32> Stop-Process -Name Notepad -Confirm

341 Views
To stop the specific instance of the process, Process ID needs to provide to Stop-Process cmdlet.ExampleIn the below example, we need to stop Notepad process with instance ID 25400.OutputHandles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 228 14 3156 13680 0.13 4900 1 notepad 232 14 3196 13752 0.16 25400 1 notepadStop-Process -Id 25400 Now, when Get-Process command is run, there will be no process running with –Id 25400.CommandPS C:\WINDOWS\system32> Get-Process -Name notepadOutputHandles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 227 13 2808 13492 0.14 4900 1 notepad

2K+ Views
To stop running all the instances of the process in PowerShell Stop-Process command is used. For example, in the below example, we have two running instances of notepad.exe process.CommandPS C:\WINDOWS\system32> Get-Process notepadOutputPS C:\WINDOWS\system32> Get-Process notepad Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 228 13 3160 13448 0.14 15564 1 notepad 228 14 3148 13668 0.17 22644 ... Read More

885 Views
To display only the first 5 processes you need to use –First parameter in the Select-Object pipeline statement. You can use multiple filter statements and later at last pipeline the –First command to display only a few results.CommandGet-Process | Select -First 5OutputHandles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 498 26 9736 18624 2.27 6320 1 AcroRd32 624 51 112048 ... Read More

406 Views
You can group the processes based on their properties. Here, we will group the processes based on their name, it would display how many instances of the process is running. Group-Object command is useful for it.CommandThe below command will group the object and sort the object based on their thread counts.Get-Process |Group-Object Name | Select Name, Count |Sort-Object count - DescendingOutputName Count ---- ----- svchost 91 chrome 34 RuntimeBroker 11 conhost 6 Code 6 WmiPrvSE 6 dllhost 4 RAVBg64 4 powershell 3 csrss 2 fontdrvhost 2 AcroRd32 2 taskhostw 2 SkypeBridge 1 smartscreen 1 smss 1 sihost 1 SkypeApp 1 SkypeBackgroundHost 1 sppsvc 1 StartMenuExperienceHost 1