I’ve seen lots of methods for checking whether or not a variable in Powershell contains an array. All of them work, so really it comes down to which one is the easiest. Some cmdlets and constructs will error out if you treat them like an array, or more commonly, produce unexpected results. Here are the two methods I’ve used for this over the years, I’ll let you be the judge of which one is the easiest.
No comments