Get Specific Process Information Using PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 12:22:07

2K+ Views

To find the specific process using Get-Process cmdlet, you need to use the –Name parameter. You can use single and multiple process names.CommandGet-Process -Name AcroRd32, audiodgOutputHandles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName ------- ------ ----- ----- ------ -- -- ----------- 506 27 9888 19216 2.22 6320 1 AcroRd32 632 51 112196 17648 42.95 8052 1 AcroRd32 209 13 10344 17100 13.98 22748 0 audiodgYou can also achieve the same using Where-Object (alias: Where) command.Get-Process | Where{$_.Name -eq "AcroRd32"} But to get the multiple processes you need to use the –OR comparison operator.Get-Process | Where{($_.Name -eq "AcroRd32") -or ($_.Name -eq ... Read More

Sort Processes Based on Their Property Name Using PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 12:18:58

4K+ Views

To sort the processes based on their various property names, Sort-Object command needs to pipeline and property name should be entered followed by it to the Get-Process cmdlet or WMI class or CIM instance.CommandTo sort the property based on the CPU usage.Get-Process | Sort-Object CPUOutputHandles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName -------  ------    -----      -----     ------     --  -- -----------       0       0       60          8                 0 ... Read More

Print All Distinct Integers from K Numbers in C++

sudhir sharma
Updated on 22-Jan-2020 12:18:14

291 Views

In this problem, we are given an array of N integers and a number K. Our task is to print all distinct numbers that can be created by adding any K elements from the array. While choosing any number can be repeated K times.Let’s take an example to understand the problem −Input: array = {2, 5, 13, 9} K = 2 Output: 2, 7, 15, 11, 10, 18, 14, 26, 22 Explaination: 2 elements added : 2+2=4, 2+5=7, 2+13=15, 2+9=11, 5+5=10, 5+13=18, 5+9=14, 13+13=26, 13+9=22, 9+9=18To solve this problem, we will find all combinations of the k element from the ... Read More

Get All Processes on Remote Computers Using PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 12:17:11

20K+ Views

To get all running processes on the remote computer, you need to use – ComputerNameparameter in Get-process cmdlet, WMI class Win32_Process or using the Get-CimInstance cmdlet.With –ComputerName parameterGet-process -ComputerName Test-PCTo connect multiple computers use computer names separated by comma (,).Get-process -ComputerName Test-PC, Win2k8 With WMI object to get processes on multiple remote computers.Get-WmiObject Win32_Process -ComputerName Test-PC, Win2k8Get-CimInstance cmdlet to get processes on remote computers.Get-CimInstance Win32_Process -ComputerName Test-PC, Win2k8

Get Running Processes with CIM Instance Using PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 12:16:42

1K+ Views

You can also display the running process on the computer using the Get- CimInstance command with the same class Win32_Process that the WMI object is using.CommandGet-CimInstance Win32_ProcessOutputProcessId Name                HandleCount WorkingSetSize VirtualSize --------- ----                ----------- -------------- ----------- 0         System Idle Process 0           8192           8192 4         System              6387        970752         5177344 96        Registry            0           76951552       173195264 568       smss.exe            53          495616         2203359674368 800       csrss.exe           883         4653056        2203416825856 896       csrss.exe           817         5349376        2203449389056 920       wininit.exe         156         4886528        2203387420672 956       winlogon.exe        264         9486336        2203423092736 8         services.exe        838         10129408       2203391979520 684       lsass.exe           1870        20848640       2203418796032

Print All Distinct Permutations of a Given String with Duplicates in C++

sudhir sharma
Updated on 22-Jan-2020 12:15:39

346 Views

In this problem, we are given a string that may contain duplicate characters. Our task is to print all distinct permutations of the strings.Let’s take an example to understand the problem −Input: string = “XYZ” Output: XYZ XZY YXZ YZX ZYX ZXYTo solve this problem, we have to fix one element of the string. And then iterate all the elements of the strings.ExampleProgram to implement our solution,  Live Demo#include #include using namespace std; int compare(const void* a, const void* b) {    return (*(char*)a - *(char*)b); } void swapChar(char* a, char* b) {    char t = *a; ... Read More

Get Running Processes with WMI Object Using PowerShell

Chirag Nagrekar
Updated on 22-Jan-2020 12:15:13

3K+ Views

To get the running processes with a WMI object, you need to use class Win32_Process. With this method, you will get more properties than the Get-Process command.CommandGet-WmiObject –Class Win32_ProcessOutputGENUS                    : 2 __CLASS                    : Win32_Process __SUPERCLASS               : CIM_Process __DYNASTY                  : CIM_ManagedSystemElement __RELPATH                  : Win32_Process.Handle="0" __PROPERTY_COUNT           : 45 __DERIVATION               ... Read More

Print All Full Nodes in a Binary Tree in C++

sudhir sharma
Updated on 22-Jan-2020 11:42:51

662 Views

In this problem, we are given a binary tree. Our task is to print all nodes of the tree that are full nodes.The binary tree is a tree in which a node can have a maximum of 2 child nodes. Node or vertex can have no nodes, one child or two child nodes.Example −A full node is a node that has both its left and right child available. In other words, a node with the left and right child is a full node. In the above binary tree, 4 and 9 are full nodes.Let’s take an example to understand the ... Read More

Print All Funny Words in a String in C++

sudhir sharma
Updated on 22-Jan-2020 11:38:09

256 Views

In this problem, we are given a sentence. Our task is to print all strings from the sentence that are funny words.Funny word is a word that follows the condition - The absolute difference between adjacent characters of the string and its reverse string is equal.|string[0] - string[1]| = |revstring[0]-revstring[1]|Let’s take an example to understand the problem −Input: string = ‘ABRS’ Output: Yes Explanation: Reverse string = SRBA |A-B| = 1 = |S-R| |B-R| = 16 = |R-B| |B-A| = 1 = |R-S|To solve this problem, we have to extract each string from the given sentence. And print if the ... Read More

Print All Good Numbers in Given Range in C++

sudhir sharma
Updated on 22-Jan-2020 11:34:48

865 Views

In this problem, we are given three values L, R, and d. Our task is to print all good numbers within the range L to R that do not contain the d as its digit.A good number is a number in which every digit is larger than the sum of digits of its right (all less significant bits than it). For example, 732 is a good number, 7> 3+2 and 3>2.Now, let’s take an example to understand the problem, Input: L = 400 , R = 500 , k = 3 Output: 410, 420, 421Explanation − good numbers between 400 ... Read More

Advertisements