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: The sequence of numbers in the array starts at 1 The values increment by 1 […]
Archive for October, 2018
Find a missing integer–alternative solution
Posted by: richardsiddaway | October 31, 2018 Comments Off on Find a missing integer–alternative solution |Finding and removing duplicates
Posted by: richardsiddaway | October 29, 2018 Comments Off on 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 ) $iarray | Group-Object | where Count -gt 1 | foreach { New-Object -TypeName PSobject -Property […]
Find a missing integer
Posted by: richardsiddaway | October 25, 2018 Comments Off on 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. Consider an array of integers. It should have 10 members: $iarray = 1,2,3,4,5,6,7,8,9,10 But […]
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 error handling techniques. $epath2 = $null Get-ChildItem -Path C:\Windows\System32 -Recurse -Force -Directory -ErrorVariable epath2 […]
Test-Connection cmdlet
Posted by: richardsiddaway | October 21, 2018 Comments Off on 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 – hopefully for v6.2 This is your chance to comment on a cmdlet […]
DevOps team structures
Posted by: richardsiddaway | October 19, 2018 Comments Off on 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 as tools team Rebranded administrators Ops embedded in dev team Dev and DBA silos […]
PowerShell v6.2 preview 1
Posted by: richardsiddaway | October 18, 2018 Comments Off on 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 Test-Connection and –workingdirectory issues are still unresolved. There’s nothing earth shattering in the updates but […]
PowerShell v6.1 working directory
Posted by: richardsiddaway | October 18, 2018 Comments Off on 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. In my profile I set the location to C:\scripts where I keep my work in […]
PowerShell approved verbs
Posted by: richardsiddaway | October 17, 2018 Comments Off on 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 the list of approved verbs using Get-Verb. There’s also a set of […]
Running Ping tests
Posted by: richardsiddaway | October 16, 2018 Comments Off on 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 tests. In fact the control script could be used to run any set of tests […]
Categories
- .NET
- Active Directory
- Architecture
- Azure
- Bash
- BITS
- Books
- CDXML
- CIM
- Cloud
- COM
- Containers
- Deep Dive
- Desired State Configuration
- DevOps
- DHCP
- DNS
- DSC
- European Summit
- Events
- Exchange
- File System
- Firewall
- General
- General IT Matters
- Hyper-V
- IIS
- Infrastructure
- IT Community
- IT Security
- Learning PowerShell
- Linux
- Math
- Microsoft
- Modules
- Nano Server
- Networking
- Office 2010
- Office 2013
- Open Source
- Opinion
- Outlook
- Philosophy
- PowerShell
- PowerShell 7
- PowerShell and .NET
- PowerShell and Active Directory
- PowerShell and CIM
- PowerShell and Exchange 2007
- PowerShell and IIS
- PowerShell and SQL Server
- PowerShell and WMI
- PowerShell Basics
- PowerShell original
- PowerShell Summit
- PowerShell User Group
- PowerShell User Group 2
- PowerShell v2
- PowerShell V3
- PowerShell v4
- PowerShell v5
- PowerShell v6
- PowerShell.org
- PowerShellGet
- PowerShellV2
- PSAM
- Rant
- Registry
- Scripting
- Scripting Games
- Scripting Games 2104
- Security
- SQL Server
- Storage
- Strings
- Summit
- Technology
- Uncategorized
- Virtualization
- Windows 10
- Windows 2012 R2
- Windows 7
- Windows 8
- Windows 8 Server
- Windows 8.1
- Windows Server
- Windows server 1709
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
- WMFv5
- WPF
- WSUS