PowerShell for Windows Admins:

Powershell


December 12, 2018  12:43 PM

Return of the missing PSDiagnostics

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

Return of the missing PSDiagnostics members in PowerShell v6.2 preview 3. In Windows PowerShell v5.1 the PSDiagnostics module contains these...

December 12, 2018  7:42 AM

Find duplicate characters in a string

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

Staying with our current theme of manipulating strings this is how you find duplicate characters in a string.   0 Comments     RSS Feed     Email a friend


December 11, 2018  10:42 AM

Join-String

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

Join-String is a new cmdlet in PowerShell v6.2 preview 3. Join-String enables you to use the pipeline to join strings. We’ve had the –join operator for a long time: PS>  1..3 -join ',' 1,2,3   As an alternative you could do PS>  1..3 | Join-String -Separator...


December 11, 2018  5:23 AM

PowerShell v6.2 preview 3 install issue

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

PowerShell v6.2 preview 3 install issue - PowerShell v6.2 preview 3 is now available from https://github.com/PowerShell/PowerShell/releases but you may notice a probloem if you...


December 6, 2018  9:12 AM

Count the occurrence of given character in a string

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

Last time I showed how to get the number of occurrences of each character in a string but how do you count the occurrence of given character in a string?   You use one of the fundamental concepts on which PowerShell is built – its composability. In other words PowerShell is composed...


December 5, 2018  10:22 AM

Count occurrence of characters in a string

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

How do you count occurrence of characters in a string? Group-object is a ready made cmdlet to answer this question   0 Comments     RSS Feed     Email a friend


November 30, 2018  6:00 AM

Test if string contains numeric

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

How can you test if a string contains a numeric character? The simple answer is to use a regular expression.  If you’ve been reading my stuff for any length of time you’ll know how much I love regular expressions. This is a simple regex. Create a string PS>  $s1 =...


November 28, 2018  1:49 PM

Test if a string is a palindrome

Tom Curtin Tom Curtin Profile: Tom Curtin
Powershell, PowerShell Scripts, String

This is the first in a short series in which I’ll look at some string handling techniques. PowerShell is all about objects but sometimes you just have to work with the basics. In this post I’ll show how to test in a string is a palindrome. A palindrome is a list of characters that read the...


November 27, 2018  6:44 AM

Third way to find pairs for given sum

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

There’s a third way to find pairs for given sum that’s a bit more complicated. function get-pairs2 { [CmdletBinding()] param ( [int[]]$iarray, [int]$value ) $sarray = $iarray | Sort-Object Write-Information -MessageData "Array: $iarray" -InformationAction...


November 26, 2018  9:11 AM

A more elegant way to find pairs

Richard Siddaway Richard Siddaway Profile: Richard Siddaway
Powershell

Last time I showed a brute force way to find the pairs of numbers in an array that would sum to a given value. This time I have a more elegant way to find pairs.   function get-pairs1 { [CmdletBinding()] param ( [int[]]$iarray, [int]$value ) Write-Information -MessageData...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: