The “Hey, Scripting Guys!” blog has been retired. There are many useful posts in this blog, so we keep the blog here for historical reference. However, some information might be very outdated and many of the links might not work anymore.
New PowerShell content is being posted to the PowerShell Community blog where members of the community can create posts by submitting content in the GitHub repository.
Summary: Using the split method in a more powerful fashion to split an array based upon two line terminating types
(image)
Hey, Doctor Scripto. I was wondering if there was a more efficient way of converting a Here-String to an Array when there were multiple line termination options like Linefeed or Carriage Return and Linefeed?
(...
Summary: Using PowerShell and Regular Expressions as a wrapper on NetSh.exe output to identify the profiles.
Hey, Doctor Scripto!
I have a whole pile of old Wireless profiles that have been collecting dust. I know I can use NETSH to view and delete them, but the process is very manual. Do you know if there is an easier way to clear them ...
Summary: Using $PSVersionTable to identify if you are on Windows or Unix
(image)
Hey, Doctor Scripto! I'm working on my PowerShell scripts and I need to be able to identify if I'm working on Windows or Linux. How can I do this easily?
(image)
No problem at all and glad to help. Just examine the $PSVersionTable property called ...
Summary: Creating a Function in PowerShell and the power of the $PSVersionTable to make code more portable
Q: Hey, Doctor Scripto!
I saw that post last week on converting Here-String into an array. I wanted to write my code to trap for PowerShell and PowerShell Core. Could you give me a helping hand?
—PG
A: Hello PG,
Hello ...
Summary: Pulling up the properties of $PSVersionTable to identify your PowerShell edition
(image)
Hey, Doctor Scripto! I want to write my modules and scripts to be more portable. How can I tell if I am executing on PowerShell Core?
(image)
Just use the $PSVersionTable object and examine the PSEdition value. If it returns 'Core' ...