Tuesday, 27 February 2018

Script: Logging the input Parameters and its values

This blog post is actually t share one of my utility script. We all write scripts to automate our tasks. We often(or always) write scripts which will be consumed by an end user as well. In this case logging is an inevitable part for a script.

We all(at least me) start developing a script initially without any logs and once the skeleton is ready we will start putting enough logs to it and one of the most important part of logging in a script is the user inputs log, We should be logging the values provided by the end user(except secrets), which will help anyone to troubleshoot if the script fails.

I always had situations to put or enhance logs for existing scripts. As a person who loves automation, I thought of automating the maximum possible for this, which actually ended up in this small utility script.

The below script will allow us to get the expression that we can put in our Script and covers the user inputs, basically the parameters and its values.

More details in Get-Help .\Build-ParamLog.ps1 -Full

The script is available in TechNet script center as well. Link

Hopes this saves copy pastes and mouse clicks...

Enjoy exploring PowerShell !!!

2 comments:

  1. The device was approved by Nevada regulators and offered to Royal Caribbean Cruise Lines for use in its casinos. The reels may spin no faster than eighty rpm, and the reels must cease within a hundred ninety ms of pressing the button. This means they'll slip a lot as} three symbols to cheat you out of your skill-stopped win. Not that there are three symbols seen directly for each reel. But they'll additionally cheat in your favor by helping you win once they can afford it. They MUST spin in a giant 1xbet bonus within, say 2000 spins, so if people keep lacking it, ultimately it will be to be|will probably be} pressured in.

    ReplyDelete