Monthly Archives: October 2018

Find a missing integer–alternative solution

In my recent post about finding a missing integer in an array of numbers I didn’t spell out the assumptions. In this post I’ll explain those assumptions and show you how to Find a missing integer–alternative solution. The assumptions were: … Continue reading

Posted in Powershell | Leave a comment

Finding and removing duplicates

Continuing the thoughts about techniques for dealing with integer arrays – this is how to go about finding and removing duplicates from the array. First – to find any duplicates use Group-Object function get-duplicate {   [CmdletBinding()]   param (     [int[]]$iarray   ) … Continue reading

Posted in Powershell | Leave a comment

Find a missing integer

I stumbled across a set of programmer interview questions recently. They raised some interesting problems that I thought would be fun to show a PowerShell answer. This is the first of them – find a missing integer in an array. … Continue reading

Posted in Powershell | 3 Comments

Managing errors

If you try to do a directory listing through C:\Windows\system32 you’ll get some access denied errors. I’m going to show you how to do this while managing errors that arise. The code will also highlight a few of the PowerShell … Continue reading

Posted in Powershell | Leave a comment

Test-Connection cmdlet

The Test-Connection cmdlet wasn’t included in PowerShell v6.0 but did make a come back in v6.1. The v6.1 version of Test-Connection has some serious issues as I’ve described before. Work is being done at the moment to remedy those issues … Continue reading

Posted in PowerShell v6 | Leave a comment

DevOps team structures

DevOps has never really excited me and I never understood why until I read about DevOps team structures – https://web.devopstopologies.com/ The article suggests 7 bad practices or ‘anti-types: Dev and Ops Silos DevOps Team Silo Dev doesn’t need Ops DevOps … Continue reading

Posted in DevOps | 1 Comment

PowerShell v6.2 preview 1

PowerShell v6.2 preview 1 quietly appeared yesterday – https://github.com/PowerShell/PowerShell/releases No major breaking changes. New features include: Type accelerators for unsigned integers Support for cd+ Test-ModuleManifest update to correctly populate nested modules Set-Service –status stopped will also stop dependencies   The … Continue reading

Posted in PowerShell v6 | Leave a comment

PowerShell v6.1 working directory

PowerShell v6.1 introduced a very annoying change in that a –workingdirectory parameter was added to pwsh.exe. When you install v6.1 working directory is automatically set to ~ which is your home folder. The workingdirectory doesn’t play nice with your profile. … Continue reading

Posted in PowerShell v6 | Leave a comment

PowerShell approved verbs

PowerShell uses a verb-noun style for naming cmdlets. The list of Powershell approved verbs is available at https://docs.microsoft.com/en-us/powershell/developer/cmdlet/approved-verbs-for-windows-powershell-commands. You should use the approved verbs when writing functions or cmdlets. Import-Module will complain about using unapproved verbs. You can also see … Continue reading

Posted in Powershell | 1 Comment

Running Ping tests

I’ve shown how to discover network information using the get-internetconnection function and how to construct simple Pester tests to ping the IP addresses returned by get-internetconnection. This time I’ll show you how to create a control function for running ping … Continue reading

Posted in Powershell | Leave a comment