You would expect `Get-Process` to do the job, but it turns out that its CPU metric is not on a 0..100% scale. Here is a one-liner (find who's eating into your CPU - or that of a remote server).
You will need a command line SVN tool for this to work. Install it on your machine and configure environment:path to point to its binaries. Then use below Powershell script. It needs to be executed under a versioned folder, and it will output a log for that folder.
Because there is no easy/built-in way to edit XML using Powershell, I wrote a script that can change parts of XML documents. I used it for bulk edit of connections in Remote Desktop Manager, to change some values in RDP session over dozens of servers. You can modify it for your needs - in simple cases you would only need to change `ArrayOfConnection` to your document's root.
There are many ways to do this, depending on what you need. In this article I'm going to highlight 2 of them. (1) Function-style conversion (2) Filter-style conversion.
With the above line, we are removing every shortest set of symbols within triangle brackets. The word shortest is very important here. Have a look at this wiki page for more information about greedy and lazy matching.
As a little brainstormer, suppose you have a variable with the following test content. Here is how you can print all odd lines from it. Or, if you want all even lines, change the initial $f value to 1.
Here is a PowerShell one-liner [...] If you need to dynamically resolve a host IP from its name [...] The whole script may look like the following [...] Because it's WMI based, computer can be from any network. But you must have necessary account permissions and firewall rules.
In this article we are going to discuss basics of how to control code execution in a PowerShell script. There are several keywords, which have slightly different behavior - BREAK, RETURN and EXIT.
Actually, there are many ways to get name of the user, which is currently logged on, including built-in .NET commands. But let's keep our code clean and stick with native PowerShell.
There are tons of ways to check if the port is open on a remote server. I think I found the fastest one, which is a Powershell one-liner.