3 min read
What's catch without try in PowerShell? It's a trap – Read how to use it!
Are you familiar with try...catch error handling? What is a catch block without a try block? It's a trap – and here is...
Unlocking the Power of PowerShell: Tips for Success
Boost your PowerShell functions with easy-to-add help links. Make it simple for users to access tutorials and support directly from your scripts!
When creating PowerShell functions, there’s a simple way to add a URL to any website you like. Whether you host your code publicly at GitHub, or whether you run an internal web portal in your company, you can easily have functions point to wikis, example tutorials, or support:
function Invoke-Something
{
[CmdletBinding(HelpUri='https://support.scriptrunner.com/')]
param()
'Get-Help Invoke-Something -Online' | Set-ClipBoard
"In order to see my help, run Get-Help Invoke-Something -Online. I placed the commands into your clipboard."
}
When you run this function, nothing special happens as it is just illustrating the function wrapper with no special code inside it. However, the function defined a "HelpUri", and users can now easily visit this URL in their browser by using Get‑Help -Online:
Unleash the full potential of PowerShell with our handy poster. Whether you're a beginner or a seasoned pro, this cheat sheet is designed to be your go-to resource for the most important and commonly used cmdlets.
The poster is available for download and in paper form.
Oct 30, 2024 by Aleksandar Nikolić and Dr. Tobias Weltner
Are you familiar with try...catch error handling? What is a catch block without a try block? It's a trap – and here is...
Oct 30, 2024 by Aleksandar Nikolić and Dr. Tobias Weltner
As $error is a global variable, consider using your own logging variable for error handling so you don't affect other...
Oct 29, 2024 by Aleksandar Nikolić and Dr. Tobias Weltner
Tobias Weltner and Aleksandar Nikolić joinly wrote the blog post series 'Tobias&Aleksandar's PowerShell tips'. So we introduce both of them here:
----------------------------
Aleksandar Nikolić is a Microsoft Azure MVP and co-founder of PowerShellMagazine.com, the ultimate online source for PowerShell enthusiasts. With over 18 years of experience in system administration, he is a respected trainer and speaker who travels the globe to share his knowledge and skills on Azure, Entra, and PowerShell. He has spoken at IT events such as Microsoft Ignite, ESPC, NIC, CloudBrew, NTK, and PowerShell Conference Europe.
----------------------------
Tobias is a long-time Microsoft MVP and has been involved with the development of PowerShell since its early days. He invented the PowerShell IDE "ISESteroids", has written numerous books on PowerShell for Microsoft Press and O'Reilly, founded the PowerShell Conference EU (psconf.eu), and is currently contributing to the advancement of PowerShell as member in the "Microsoft Cmdlet Working Group". Tobias shares his expertise as a consultant in projects and as a trainer in in-house trainings for numerous companies and agencies across Europe.