Powershell
Powershell stuff
-
Running a function inside a remote session or ForEach-Object -Parallel can be tricky because the function isn’t available on those computers or sessions. While copying the function’s contents into the scriptblock is an option, it requires revisiting the script whenever the function changes—not the best approach.
-
The tale of the missing property and Register-PSRepository.
-
Ever had a script which contains an array and a foreach loop? And then you want to test the content of the foreach, but only with one entry for troubleshooting purposes for example.
-
In a previous blog I wrote about PowerShell’s common parameters, today I dive into another aspect of parameters in functions, namely Parameter Sets. Parameter sets allow you to define different sets of parameters for a single function, this helps creating clearer and more intuitive functions. What Are PowerShell Parameter Sets? Parameter sets allow you to […]
-
In this blog post, we delve into the powerful capabilities of PowerShell for manipulating file paths. Learn how to efficiently combine paths, extract file names and extensions, and navigate directories with ease. Whether you’re a beginner or an experienced scripter, these tips and tricks will enhance your file management skills and streamline your workflow.
-
PowerShell’s common parameters are a set of parameters that are automatically available to all cmdlets and advanced functions. These parameters provide a consistent way to control the behavior of cmdlets and functions, making it easier to manage and debug scripts. In this post, we will look at the most commonly used common parameters and how to use them.
-
In this blog post, we’ll delve into the nuances of four fundamental PowerShell commands: **Break, Return, Continue, and Exit**. Each of these commands serves a unique purpose in controlling the execution flow of your scripts, whether it’s exiting loops, returning values, or terminating scripts.
-
PowerShell has a number of built-in variables that can be used for all sorts of things. One of these variable is $MyInvocation. It is useful when you need detailed information about the context in which a script or function is being executed.
-
Sometimes we need to work with file sizes in Powershell and a lot of those are displayed or required in bytes. How to calculate with those quick and easy?
-
When writing scripts, one of the most important aspects to consider is how you name your custom functions. Good naming conventions not only make your code more readable and maintainable but also ensure consistency across your scripts and modules. In this blog post, we will explore the best practices and conventions for naming custom functions.