Block

Block functions are used to take the place of different stops that I place in my scripts

Example

For example, I have a function that needs the following requirements

  • Runs in Full OS, not WinPE

  • Requires Admin Rights

  • Requires Curl.exe

In my code, I' would do something like this

By taking these Blocks into separate functions, I can easily add this to my PowerShell script and greatly simplify things as well as ensuring consistency

Real World Example

In the real world, I have a function that has these blocks in place

And when running the function in PowerShell as a Standard User, I receive the following:

The Code

This is what the code of a Block will do. By default, a Warning with a Timestamp and calling Function will be displayed, followed by a Break. These can be adjusted with two Parameters

-Warn

Provides a Warning without a Break

-Pause

Adds a Press Any Key to continue

Last updated

Was this helpful?