Showing all posts tagged: 'script'

A 5-post collection

Install and run the Azure CLI on the Windows Subsystem for Linux (WSFL)

I've [blogged before](GHOST_URL/working-with-bash-on-ubuntu-on-windows-10/" target="_blank) about the tremendous work that the Windows team has done to bring a truly integrated Linux subsystem on Windows 10. That's right, you can use the native Linux (user and kernel modes) inside Windows without the need of a VM, Container or any other emulator. This has opened up so many possibilities and brings a very powerful tool to Windows. Using native Bash is a dream come true for many people and even me, whose use of it is limited to 0.05% of its true capabilities!!! Do I care? …[read more]


Automate login for Azure Powershell scripts with Service Principals

Automation is great. It's the bedrock of any successful IT department and the default solution for any task that has to be repeated more than once. I'm a big proponent of automation and, since I spend most of my time in Azure, I try to automate as many tasks as I can. Today, I'll explain how to automate your Azure login in order to allow your scripts to run without any supervision. Disclaimer: many of these tasks should be running using the [Azure Automation service](https://azure.microsoft.com/en-us/services/automation/" target="_blank) because of better integration …[read more]


Generate Guids with PowerShell or ScriptCs

There are many ways to generate GUIDs. You can use one of the many free websites or you can write your own (quick) script to do it. If you want to create your own script, there are 3 easy approaches: PowerShell ScriptCs Uuidgen.exe The first two are very powerful and versatile and can do a lot more than just generating GUIDs. The 3rd one is a dedicated utility for generating GUIDs only. PowerShell PowerShell is first as it's the easiest of the 2. Easiest to get started, that is. PowerShell is already installed on your Windows machine. Just bring …[read more]


Execute SQL Query with PowerShell

Scripting is very powerful. And for me, one of the best scripting languages is PowerShell (PoSH). Yes, PoSH takes a bit of getting used to, but once you pass the initial learning curve, you end up with a powerful tool in your hands. One thing that I love about PoSH is a little secret that not many people know: PowerShell allows you to import .NET namespaces and libraries and, in effect, you can write C# code to solve any problem you may have. The PowerShell's libraries, cmd-lets are very comprehensive but you can always come against something not "natively& …[read more]


Using PowerShell to resolve Host names to IP address

Today's post is to be a quick one, more like a useful DevOps tip. Today, I was given a list of hosts that I had to resolve to IP addresses in order to add them to a config file. Obviously there are a few ways to do this, but I wanted to automate it because you never know when someone will request something similar. Powershell to the rescue then. The script is pretty simple and I bet that it can be condenced even more, but I like my code and scripts as readable as possible. It is handy to remember …[read more]