Showing all posts tagged: 'PowerShell'

A 12-post collection

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" available. …[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]


Copying VHDs between private storage accounts

If you ever need to copy VHDs between two different storage account, you can use the PowerShell script below to do it in few steps: Perform the copy Firstly select the subscription you need to work with. Select-AzureSubscription "MySubscriptionName" Define the source VHD - authenticated container. You can get the vhd name and url from the portal $srcUri = "https://mysubscription.blob.core.windows.net/vhds/yourvhdname.vhd" Define the source Storage Account. This is where the vhd is currently located. The Private key can be acquired from the azure portal $srcStorageAccount = "sourceStorageAccount" $srcStorageKey = "GET KEY FROM PORTAL" Define the destination …[read more]



Setting up a new Windows 8.1 machine the easy way - using Chocolatey Nuget

I admit it! I like new, shiny things. Besides, I wanted to sync all my devices (Surface and laptop) to the same version of the OS. The Surface Pro upgrade was a breeze. Since I don’t keep any data on my Surface, it was a case of just running the upgrade. However, the laptop upgrade wasn’t as straightforward, since I’m running Windows 8 on a Mac Book Pro Retina using Bootcamp. Yes, I know, it’s wrong, but I like it so deal with it. Since the inline upgrade didn’t work and rendered my machine useless …[read more]