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: 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' ...
Summary: Discovering some of the awesome and neat ways to leverage a Here-String in a Script or function
Q: Hey, Doctor Scripto!
I used to write scripts with supporting configuration files that never really changed. I was wondering if there was any way to put them INSIDE the script directly to make it self contained.
—AB
A: Hello...
Summary: Using the ConvertFrom-Json Cmdlet in PowerShell to read a JSON formatted file
(image)
Hey, Doctor Scripto! I've seen a lot of JSON files in use in Azure. I'm not very good with editing JSON properly. Is there an easy way to read this and at least edit it with PowerShell?
(image)
Most definitely my good friend. For the ...
Summary: Using the ConvertFrom-JSON and ConvertTo-JSON Cmdlets to edit a configuration file
Q: Hey, Doctor Scripto!
I need to be able to change the Startup settings in Teams (like the Auto launch feature). I can change it in the Interface, but I need to be able to edit across multiple systems. Could you lend me a hand?
—RL
A: ...