#powershell

13 posts tagged powershell.

2017 1 post

  1. Updated

    Powershell - Get CPU Usage by Process (remote)

    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).

2013 1 post

  1. Updated

    Powershell - Export Logs from SVN

    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.

2012 2 posts

  1. Updated

    Edit XML using Powershell

    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.

  2. Updated

    PowerShell - Convert Array To HashTable

    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.

2010 6 posts

  1. Updated

    PowerShell - Strip Html Tags From a String

    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.

  2. Updated

    PowerShell - Print All Odd/Even Lines

    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.

  3. Updated

    PowerShell - Get MAC Address Of Any Remote IP

    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.

  4. Updated

    PowerShell - Control Code Execution

    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.

  5. Updated

    PowerShell - Get Current User

    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.

  6. Updated

    PowerShell - Check if remote port is open

    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.

2009 3 posts

  1. Updated

    PowerShell - Query Oracle Database

    You might have already googled other pages to help you on this. You even probably have found some PowerShell function like the one below [...] Still something makes this one different. Here are some tricks used here [...]

  2. Updated

    PowerShell - view current version

    I'm usually lazy to remember which version of PowerShell (if any) was installed on each and every server in our site. Because each generation of OS has its own way to install/reinstall PowerShell, sometimes I need to see if it's anything there already and I need to perform a clean up.

  3. Updated

    Powershell Special Characters And Tokens

    This article originally started when I was actively involved in PowerShell development. Now I am mostly updating it on request of my blog readers (people like you). After a few dozen updates over the course of many years, it is now regarded as one of the top resources in the Powershell community.