Category: Scripting

Ternary Operator in PowerShell

I’m very noob .Net C# developer, but I remember this: <compare> ? <value of true> : <value of false> (a == ‘a’ ) ? 1 : 2 I want the same thing in PowerShell, here we go:


Which I came up with a more readable and something easy to memory:


PowerShell – Multidimensional arrays in PowerShell

You may have some arrays like this:

Then you may want to combine them together:

But unfortunately it’s not simple like this… You will get:

Suppose to be 2, right? Why it’s 6… Let’s identify…

But what I want it to be is $School contains $year1 and $year2, and $year1 contains…

How to convert string to Base64 and vice versa using Powershell

Working with Consul without UI is the correct way to go, which also help you with the productivity!!! (True?, hahaha~~)   Anyway, I’m not allowed to have a UI for it, come down to have read the correct value and make sure it’s the one we want it to be in there, I need to…

Send email via PowerShell

I need to send a large number (more than 100) emails to my wife for her needs. She has a folder that contains tones pdf files, needs to be send to an email address one file per email. So I created this script to send the mail… For sure you need to modify this if…


Start playing Terraform … Get it downloaded & saved it to a local folder: C:\bin Put this path into local $PATH var by running:

Restart a command line, type in “terraform”:

Once you can see above, “Terraform” is correctly installed.   Due to I only have Azure account, so I’ll start playing with…