Powershell - Get CPU Usage by Process (remote)
· ☕ 1 min read
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).

Powershell - Export Logs from SVN
· ☕ 1 min read
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.

Edit XML using Powershell
· ☕ 1 min read
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.

PowerShell - Convert Array To HashTable
· ☕ 1 min read
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.

PowerShell - Strip Html Tags From a String
· ☕ 1 min read
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.

PowerShell - Print All Odd/Even Lines
· ☕ 1 min read
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.

PowerShell - Get MAC Address Of Any Remote IP
· ☕ 2 min read
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.

PowerShell - Control Code Execution
· ☕ 5 min read
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.

PowerShell - Get Current User
· ☕ 1 min read
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.