This is a script function, you can run the function simply by using “Export-AzureVMImageList ” than this will generate a list of all Azure Virtual Image list those are available in to a HTML page and the page will open automatically.

If you want to export the Azure VM image list to the .CSV format, then just use the –CSV “Export-AzureVMImageList-CSV” switch with the function and it will generate a .CSV file containing the same information.

Exporting the list either to .CSV or HTML is quite handy, so that you can search the name and DISK image of the OS easily which you want to create, after having a list, it’s a matter of sec milliseconds, copy and paste.,

The IF block checks if the –CSV is ON or OFF, if the –CSV is present in function, then it will run theIF block code to export the file to .CSV format, otherwise the ELSE block will run and export the file in the HTML format.

The ForEach loop.

By using For-Each loop , we are manipulation with data and saving it as a single line to avariable “$body1”

That’s it J , you know the trick, Now download the script and play with it. Try to change the default path. Try to change the File Name, or try to add some new parameters.

Check the video below on "How you can run the script".

Export-AzureVmList

Me: Happy?

A! Murky Ana. : Yes,

Me. : Go and now learn more about "Microsoft Azure and PowerShell"

and she hung up the phone!!!

HOW RUDE............

* All characters appearing in this work are fictitious Any resemblance to real persons, living or dead, is purely coincidental.

Tuesday, February 10, 2015

She emailed me, Yes! "A Murky Ana!" and in the email she asked me that if it is necessary to document a "PowerShell Module version" in the "PowerShell scripts"?

I replied to her :-

Hi Ana!,

It's really good to document "PowerShell Module" version information of you are about to use a single PowerShell module only. For example, if you about to write a Long PowerShell scripts only for Microsoft Azure, then it's worth to mention a module version on the top of your PowerShell Scripts.

it's help other to check their Azure PowerShell module version before running your scripts so that no compatibility issues arises. If you like you can write a little bit tiny-miny PowerShell function to check the module version and only run the scripts if they match the desired version of the PowerShell modules.

Checking the version of any module is very simple, just see the below command for an example.

PSC:\> (Get-Module-Name'Azure').Version

I am hoping that you are able to understand now that it's a good to write the information of Module versions in the scripts.

* All characters appearing in this work are fictitious Any resemblance to real persons, living or dead, is purely coincidental.