Tuesday, March 01, 2016

The AzureRM module–Post the Great Renaming

Last summer (2015), the Azure PowerShell team took the decision to re-factor the then existing Azure module. You may remember, this older module was schitzophrenic – loading the modjule allowed you access to the Azure Service Management APIs. You then used the Switch-AzureMode cmdlet to enable access to the Resource Manager APIs.

Many PowerShell hands felt this was a sub-optomal approach. A more senible approach, the arugment went, would be to create a separate module (or separate modules!). The latter is what happend – ALL the RM cmdlets were removed from the old Azure Module (an updated module – which at the time of writing is version 1.0.4) is available that contains only  cmdlets that target the Service Manager APIs. At the same time, the Azure PowerShell team created a bunch of new, Resource Manager targeted cmdlets.

Another somewhat curious decision was made with respect to these cmdlets. The team created a simple module, AzureRM, whch contains cmdlets that actually to the installation and updating of the individual modules. You use the AzureRM module to actually install anbd manage the RM commands.

This means that the installation of the Resource Manager cmdlets is a two step affair. First, get the main RM module:

Install-Module AzureRM

This goes out to the PSGallery and obtains the latest version of this module. At the time of writing, this is version 1.0.4, but no doubt will change on a regular basis! The AzureRM module contains just 8 commands (1 alias, and 7 functions to be accurate) that enable you to manage the detailed sub-modules.  So once you have the AzureRM module installed, you can install the actual Azure RM Modules by

Install-AzureRM

Strictly speaking, Install-AzureRM is an alias for Update-AzureRM. You can use either to install teh individual modules. The AzureRM module also has a command to uninstall the module as well as updating the module.

To check what modules you have on yoru system, you can do this:

Get-Module AzureRM.* -ListAvailable

And, of course, when you want to update the modules that make up the AzureRM set of modules, just:

Update-AzureRM

This is a slightly different way to install/manage these modules than many of you may be used to using. But it does give the Azure PowerShell team more flexibility – to create new modules to match new Azure features and to update bits of the module set at a time. At the same time, you end up with 27 separater modules with 5 separate release versions. Keeping track of these will be work, since in some cases, updates may break earlier code.

Once you have all this done, you end up wsith 884 commands, as follows:

PSH [C:\foo]: get-command -module azurerm.* | measure | select count
Count
-----
  884

PSH [C:\foo]: get-command -module azurerm.* | group commandtype

Count Name                      Group
----- ----                      -----
    6 Alias                     {Get-AzureRmSqlDatabaseServerAuditingPol…
    1 Function                  {Get-AzureRmAuthorizationChangeLog}
  877 Cmdlet                    {Add-AlertRule, Add-AutoscaleSetting….

Monday, February 29, 2016

Get-AzureResourceGroupGalleryTemplate is missing (and a fix)

Last September, I wrote about what I call ‘The Great Azure Cmdlet Renaming’. Well, I’m now in the process of actually using the resultant cmdlets and I am having some minor frustrations.

I am following an Azure Resource Manager training course, provided by Microsoft MVA. I suppose it’s bad enough that EVERY demo shows stuff that no longer exists – all the demos are ‘wrong’. The new portal looks vastly different from the course, although with a bit of effort I can pretty much re-produce what the demos are showing. It’s tedious, but possible in most cases. And just for the record: the latest incarnations of the portal are very good - much better than in the MVA video.

But it’s not just the portal that is so different in the video, the cmdlets have changed too – with lots of renaming, etc. One cmdlet that is now totally gone is Get-AzureResourceGroupGalleryTemplate. This cmdlet returned a list of templates in Azure’s gallery along with details of the specific template.

So, while you can’t actually use this cmdlet (it no longer exists), you can re-create it like this:
Function Get-AzureResourceGroupGalleryTemplate {[CmdletBinding()]
Param(
[Parameter(Mandatory=$false,
           Position=0,
           ParameterSetName='Default')]
[Alias("ip")]
$IncludePreview = $false
)
#
$StartTime = Get-Date
Write-Verbose "Started at $StartTime"
#     Create URL
$GalleryUri = "
https://gallery.azure.com/Microsoft.Gallery/GalleryItems?api-version=2015-04-01"
if ($IncludePreview)
   { $GalleryUri += "&includePreview=true"}
Else
   { $GalleryUri += "&includePreview=false"}
#    Retrieve all available templates
Try   {
         $AllGalleryTemplates = Invoke-WebRequest -Uri $GalleryUri | ConvertFrom-Json
      }
Catch {
         "Error invoking Call to Azure Gallery"
      }
#     Write verbose return information
$EndTime = Get-Date
Write-Verbose "Finished at $EndTime"
Write-Verbose "$(($EndTime-$StartTime).totalseconds) seconds elapsed"
Write-Verbose "Templates returned: $($AllGalleryTemplates.count)"
#     And return it
Return $AllGalleryTemplates
}

Set-Alias Get-RGTemplate Get-AzureResourceGroupGalleryTemplate
Set-Alias GRGT Get-AzureResourceGroupGalleryTemplate
It’s easy enough to re-create the template – I’m not sure why it was removed in the first place. If, like me, you think that the cmdlet should be re-instated, then feel free to follow up at: https://github.com/Azure/azure-powershell/issues/1885

Monday, February 01, 2016

SSD Life Time Measurements

I’ve been looking at possibly upgrading one of my Hyper-V servers to use SSDs. I don’t have the budget yet, but have been pricing up various options. One issue that arises is about the life time of the SSD, also referred to in the literature as endurance. There seems to be two separate measurements in use: Terabytes Written (TBW) an Drive Writes Per Day (DWPD). At first, I could not see the relationship – which kind of made comparing harder.

I did a little searching and found this neat article:  Comparing DWPD to TBW which provides a nice equation for converting DWPD into TBW. The trick here is to consider the warranthy period. DWPD is a measure of how many times you can totally overwrite the disk each day and not have it fail during it’s warranty period. To convert that to TBW, as the artilce points out – you multipy DWPD by warranty period (in days) and capacity (in TB).

I am starting to see more virtualisation projects using SSD disks, so the comparison betwen vendors and product lines is important. I wish there was just ONE measure of endurance, but such is life.

Saturday, January 30, 2016

Introducing the PowerShell ISE Preview

Now this is pretty cool: http://blogs.msdn.com/b/powershell/archive/2016/01/20/introducing-the-windows-powershell-ise-preview.aspx. The PowerShell team are releasing what is effectively a beta version of the PowerShell ISE as a separate stand alone tool.

As I told my PowerShell class last week in Luxembourg, the ISE is probably the best default tool out there. It’s free, and built in. I do like some features of other ISEs, but paying for them, or having to load that ISE on mujltiple systems (vs just using the ISE) – it all makes the ISE for me the tool I use. Of course, the ISE addin model has enabled fantastic tools such as ISESteroids (which I use on my laptop and main workstation).

So having loaded it – I can’t see any difference. According to the blog post:

“this is intentional!  This first release is meant to ensure that the new preview release model will work and that there are no major issues.  After the initial release, we hope to ship a new release roughly once per month with new feature improvements and bug fixes.  It will also be a lot easier to ship minor releases to address bugs that may appear due to new features.”

Wow – monthly updates! I am so liking this new MIcrosoft that no longer has to wait three years just to fix typos in help text! Smile. This responsiveness is very attractice.

One small thing – if you are going to play with the new add-in model and want keep your real ISE and preview ISE profiles separate – you may need to use the variable $PsIse.IsPreviewRelease.  Naturally, this will be true when you are using the Preview version!”"

Friday, January 15, 2016

PowerShell’s Get-Random Cmdlet–a curiosity

I’ve been working on a new set of Introduction to PowerShell courses for a new client – and in doing do, I’m recycling bits of the courseware I’ve developed for my  my own PowerShell training courses. I’ve been running these for 10 years now and have an awful lot of  PowerShell decks on file!

I was looking at an example that was actually based on Version 2 of PowerShell. The example used the PSCX extensions’ Get-Random cmdlet. Well – in those days the PowerShell Community Extensions did contain such a cmdlet - the latest versions of PSCX have sensibly deprecatexd it in favor of the cmdlet built into PowerShell. The original PSCX cmdlet generated a random number between 0 and 1. So to generate a random number between 0 and 4, you could do this (again with the PSCX cmdlet) you could use: (Get-Random)  * 4. The smallest number generated would be .(and lots of zeros)1, and the largest .999999 etc. Multiply those by 4, and using interger rounding,  you have the random number between 0 and 4.

Well – to convert this to the built in cmdlet would, I thought, be easy.

Get-Random –Minimum 0 –Maximum 4

Except it did not seem to work right. If I ran this 100000 times, I only ever ended up with numbers zero through three. NO four. Then I looked closely at the documentation. Get-Random’s –Minimum specifies the smallest random number to be generated. The –Maximum parameter specifes a number such that the random number generated will be LESS than the maximum. SO the random number will be Greater or equal to zero, and less than 4.

So to create a random number greater than or equal to zero and less than or equal to four:

Get-Random –Minimum 0 –Maximum 5

Just goes to show, sometimes reading the documentation is useful.

Monday, January 04, 2016

Open Live Writer

I’ve been using MIcrosoft’s free Office Live Writer for several years – it’s a great tool for blogging. Just before Christmas, Microsoft announced that OLW was becoming Open Source and would be known as Open LIve Writer. Microsoft has foked the code and the OLW fork is now available via GitHub (https://github.com/OpenLiveWriter/OpenLiveWriter). Open Live Writer is provided under a MIT license.

The move to open source has not resulted in a perfect product – initially there is no spell checker in OLW. The spell checker included in the OLW is old, and the license would not have allowed it to be released as open source. The team plan to update OLW to use the Windows 8 (and later) built in spell checker. Unfortunately this probably means no spell checking for Windows 7 users.

You can find more informatiou about OLW at the web site: http://openlivewriter.org/. This pagecontans a download link, along with details of the proejct, participants, etc. The code itself, along with a nice product road map are published over on the GitHub site noted above.

This is a great idea – thanks for saving this neat bit of software.

Saturday, December 19, 2015

Symbolic Links in PowerShell V5

I have been working today with a new feature in PowerShell V5 and the ability to create symbolic links. In Windows, a symbolic link is a file system item (i.e. a file or folder) that points to some other file system object (some other file system file or folder). The symbolic link is transparent to the user, although the UI does give some clues if you know where to work.

You can also create a hard link. A hard link is an item in file store whereby more than one path references a file in the same volume.

To create these links, you could do the following:
# Create Test Folder
Set-Location c:\Foo\SlTest
mkdir C:\Foo\SlTest
#
# Now a subfolder
mkdir C:\Foo\SlTest\Real
#
# And a real doc
1..10 | Out-File c:\Foo\SlTest\Real\foo.txt
#
# Now create a symbolic link
New-Item -ItemType SymbolicLink -Name .\virtual -Target .\real  
#
# And a symlink for a file
New-Item -ItemType SymbolicLink -Name .\SYMfoo.txt  -Target .\real\foo.txt
#
# You can also create a hard link
New-Item -ItemType HardLink     -Name .\hard.txt  -Target .\real\foo.txt
Once you run this (suitably amended for your environment possibly), you would see some thing like this in Explorer and within a PowerShell V5 window (nb: I am running V5 on a Server 2012R2 system with the RTM version of WMF 5).



PowerShell shows the three links in the directory listing (note  the 'l' in the mode column). Windows Explorer, however, only shows two link symbolic links. Explorer does not show an 'L' attribute for the hard link. The hard link is kind of cool, in that you can't really see it's there from Explorer. It really looks like the file, but as a different name. The symbolic links, on the other hand show up a bit more clearly in Explorer.

I find symlinks particularly useful in my training. For my PowerShell courses, I create a 4-VM 'farm', and use differencing disks to reduce the overlap in contents (Saves around 20 GB!). I create a symbolic link for the differencing disk (ie where it should be)  that points to the one copy of that file I DO copy.  Up to now, my setup instructions require the setup tech to run a batch file using Command.com. Once PowerShell V5 is commonly available, I'll get rid of that and make the setup all PowerShell.


del.icio.us Tags: ,

Monday, October 19, 2015

Azure AD As A Service

FINALLY, the news has broken about the new AD as a Service (ADAS for lack of a better acronym). I've known about this for some time, and have been eagerly awaiting the ability to comment. My immediate reaction is highly positive – it's a major missing bit of the Azure story. Azure customers I talk to want total flexibility in where to deploy servers – and often that means deploying them near to a DC/GC to handle authentication and other tasks. And while Azure AD was a nice feature to front end MS's Sass offerings, it really did not provide all the necessary features (not least of which are machine accounts, GPOs and of course OUs, the ability to support NTLM authentication and others).

But all that's changed – and we now have a fully fledged Active Directory cloud service. Like most  of Azure, you pay for this service based on usage. Depending on the size of your deployment you'll pay anywhere from $US 37/month (for up to 5000 total AD objects) to $Us 297.60/month for up to 100,000 objects. A forth tier (more than 100,000 objects) is available but no pacing has been announced for this tier. During the current preview period, only the mid tier 5000 to 25,000 objects) is offered a a half price rate of $US 74.40/month.

There are two blog articles on the AD Team Blog which describe things in more detail. – you can see both  at: http://blogs.technet.com/b/ad/archive/2015/10/14/azure-ad-domain-services-is-now-in-public-preview-use-azure-ad-as-a-cloud-based-domain-controller.aspx

This is a big new feature of Azure and I really look forward to seeing it in operation!

Tuesday, September 15, 2015

Announcing: PowerShell PowerCamp – Oct 17-18 – London

I am pleased to announce another PowerShell PowerCamp for October 17-18th. To be held at Microsoft Victoria (Cardinal Place) London over the weekend. This is a lecture only 2-day boot camp covering the key aspects of PowerShell. Read on for more details.

What is A PowerShell PowerCamp?
PowerCamp is a fast paced weekend training event that covers all the basic aspects of Windows PowerShell - from the command line to writing production-oriented scripts. We start with the basics including configuration, formatting and providers and remoting and jobs. Then, on day 2, we look at scripting, work flows, managing script libraries using modules, WMI/CIM,  using objects, and PowerShell in Windows. The event concludes with a look at the new Desired State Configuration and other features in PowerShell 4 and 5. If time permits, we'll also take a quick glimpse at PowerShell in Server 2016, including Nano Server.

The PowerCamp event is a combination of lecture, demonstrations plus Q&A, with the opportunity to type along with the tutor. There are no formal labs. But key demos are provided along with the slides, plus a wealth of other add on material on a memory stick you get at the start of day 1. So bring along your laptop, and type away.

What is the Agenda?
The event happens over the Weekend of October 17th and 18th 2015. We start each day promptly at 9:00 and finish no later than 17:00.

Day 1 – The Basics

  • PowerShell Fundamentals – starting with the key elements of PowerShell (Cmdlets, Objects and the Pipeline) plus installation, setup, and profiles
  • What’s new in v5 – this looks at the things specifically added into PowerShell v5.
  • Formatting – how to format output nicely – both by default and using hash tables and display XML
  • Providers – getting into underlying OS data stores (certificate store, AD, registry, etc.) via providers
  • Remoting– working with remote systems using PowerShell’s remoting capabilities

Day 2 – Diving Deeper
  • Scripting Concepts – automating everyday tasks including PowerShell’s language constructs, error handling and debugging and workflows
  • Modules – managing PowerShell script libraries in the enterprise
  • Using .Net, COM, WMI and CIM objects – working with various kinds of objects
  • PowerShell in Windows – a look at what’s there and how you can leverage the huge number of cmdlets
  • PowerShell Desired State Configuration – this final module looks at PowerShell’s Desired State Configuration tool and what you can do with it.
  • A quick peek at Server 2016, including nanoserver.

What Does It Cost?
The cost is £225 (+VAT at the prevailing rate) for the weekend. Meals and accommodation are not covered.

Where Is The Event Going To Take Place?
The PowerShell PowerCamp is being held at Microsoft Cardinal Place, 100 Victoria Street in Victoria over the weekend of October 17/18 2015. Each day starts promptly at 09:00 and finishes up by 17:00. We’ll also take short break throughout the day, including a 1-hour lunch break on both days. The location is close to Victoria Station (railway and underground) with a wealth of lunch places and, if overnight accommodation is required, a range of hotels.

Who Should Attend?
Everyone who needs to learn more about PowerShell! PowerCamp starts from the beginning and we cover as much ground as possible in the two days available. In previous PowerCamp events, attendees have ranged from beginners to more advanced. Beginners benefit from a complete explanation of PowerShell, while more advanced user learn new tips and tricks to advance their usage of PowerShell. We've had several people attend more than once!

PowerDrinks
After Saturday’s session, attendees are invited to a small nearby public house for some lovely English ale and networking with each other!

Who is the tutor?
The PowerShell Weekend PowerCamp is delivered by Thomas Lee, a 17-time MVP award winner. Thomas has been involved in the PowerShell community since the very beginning. He provides training and consultancy around a range of Microsoft products, with a recent focus on PowerShell and Skye for Business Server. Thomas runs PowerShell training courses around the world, and has been a speaker at conferences across the world for the past decade. In his spare time, he lives with his wife, daughter, wine cellar, and Grateful Dead live recordings archive in a small cottage in the English countryside. His Twitter handle is @DoctorDNS and he maintains two blogs (Under the Stairs at http://tfl09.blogspot.com and PowerShell Scripts Blog at http://pshscripts.blogspot.com).

What do I need to bring?
In order to type along, you should bring a laptop with PowerShell, preferably PowerShell Version 5 , loaded. That can be either native (eg in Windows 10), or in a virtual machine. I suggest you have at least two VMs pre-configured – one a server installation the other a Windows client installation – with the server a DC and the client a member of that domain. The virtualisation software is not of concern – but you need 64-bit guest OS support for Server 2012 and later! Thus you can use Hyper-V, VMware Workstation or Oracle’s Virtual Box. Heck, run it in a VM on a Mac or Linux PC if you want. Just bring along PowerShell v3/4/5 (preferably V5!).

How do I book?
Contact DoctorDNS@Gmail.com to book a place and to arrange for the invoice to be paid. Payment must be in cash, cheque or bank transfer only no credit cards.

More Details
Watch this blog for any hot breaking news on the event.

del.icio.us Tags: ,,

Tuesday, September 01, 2015

Azure PowerShell – Some Changes and Some Good News

I recently wrote a blog post, The Great Azure Cmdlet Renaming – Coming Soon, that noted the coming changes in the PowerShell module for Azure. Well – a few weeks is a very long time, when your clock is set to Internet Time! That article, and others, caused some rethinking within Microsoft and things have changed.

One key issue that the earlier plan raised was that it meant lots and lots of existing automation would need to be updated to take advantage of the later versions of the Azure module. I have thousands of lines of automation, all created using the ASM API. The big change is that, instead of renaming the ASM cmdlets, it's the ARM cmdlets that get renamed. Thus the impact is much less.

Towards the end of a long thread at https://github.com/Azure/azure-powershell/issues/428, David Justice sets out the updated plan of action as:

  • Remove Switch-AzureMode and remove modal behaviour from Azure PowerShell
  • Re-factor the AzureResourceManager module into component modules by service and functionality (management vs. data plane by service)
  • Rename cmdlets in AzureResourceManager module from [Verb]-Azure[Noun] to [Verb]-AzureRM[Noun]  (e.g. Get-AzureRMVM).  Implicitly this means the Azure ServiceManager cmdlets in Azure PowerShell do not get renamed.
  • Distribute Azure and AzureResourceManager modules via PowerShell Gallery
  • Adding automated documentation submission to content team for publication (MSDN) upon release for all modules

There is a lot of detail in the Github post, which you should read, that explains the background and some of the details. The good news is that these changes should be available towards the end of September (2015), with Azure Automation updates at around the same time. As of the time of posting, I've seen nothing to suggest those time scales will not be met – but watch this space.

  1. All in all, progress and some good news. But confirmation of a bit of bad news too for ARM Cmdlet users)

Saturday, July 25, 2015

The Great Azure Cmdlet Renaming – Coming Soon

As many readers of this blog know, I am a fan of the Azure module – it makes it simple and relatively straightforward to automate just about all operations in Azure. I've written scripts to do all sorts of things, including creating LInux and Windows VMs, created web sites, worked with networking, etc. I have a lot of scripts out there – and soon, I am going to have to look at each and every one, and probably change most if not all of them. The Azure module is about to change in a very big way – and this could become work for some!

To understand the renaming that is about to happen, we must start at the beginning. In developing Azure, Microsoft created a REST API, the Azure Service Management (ASP) API. A set of cmdlets were created that interfaced with the API to enable automation via PowerShell of the Azure components like VMs. I use these cmdlets most days and they rock. There is room for improvement, but they work and work well.

But the Azure team created a second API, the Azure Resourced Manager (ARM) API. And the Azure module was changed to allow Azure ARM based cmdlets. The ARM API has a much different look and feel – and provides some features not available in the ASM version, particularly templates and resource groups. As an aside, I can only surmise that if thee Azure team were to go back in time, knowing what they know now, they may never have built the ASM API, going straight to ARM. But they didn't.

The impact to the user of the Azure module is how you call cmdlets targeting ARM vs. ASM. For a start, the two cmdlet sets were never meant to be loaded or used together. When you load the Azure module, you get a module of cmdlets, etc, that are targeted at the ASM API. To get to view the ARM based cmdlets, you use the Switch-AzureMode cmdlet, and  using the –Name parameter, you specify whether to use the expose  AzureResourceManager or AzureServiceManagement API based cmdlets. Both cmdlet sets feature cmdlets with the same name that do more or less the same thing, but are in compatible. You can't really mix and match between the cmdlet sets. With the latest Azure module, it looks like this:

 

image

As you can see, there a different number of cmdlets in each set, and when you use Switch-AzureMode, it removes one set of cmdlets and load a totally different module (where did that come from – we never loaded or installed an AzureResourceManager module! The magic of the Azure module makes this all work – and since scripts tend to only use one or other API set, no real harm done.

But it is confusing and from a pure PowerShell point of view, the basic design was flawed – it does need cleaning up. And, going forward, that is what Microsoft is going to do. In a post entitled Deprecation of Switch-AzureMode  in Azure PowerShell, Joe Levy spells out the need for the change and how it will happen.

The key changes are broadly as follows:

  • The Azure module will be renamed to “ASM”. And all ASM cmdlets will be prefixed with “ASM”, so Azure/New-AzureVM will become ASM/New-AsmVM or simply New-AsmVM.
  • The existing AzureResourceManager cmdlets will keep their existing names, so New-AzureVM will map to the ARM version.
  • The existing AzureResourceManager module will be broken into many modules by service and behaviour. Examples of the module names would be the following: AzureCompute, AzureNetwork, AzureStorage, …
  • Azure PowerShell and all of its modules will be distributed via MSI and PS-Get. MSI cadence will decrease because the MSI will be a wrapper for a PS-Get script.

So if you have written any scripts using ASM cmdlets, these will need to be updated to use the new cmdlet names. If you have written scripts using the ARM modules, these should not need to change much, but some change is inevitable (erg removing any Switch-AzureMode statements you have!).

If you have done ANY scripting with Azure and PowerShell, you should read the article carefully and start to work out your strategy for the updates that will be coming. The plan, at the moment at least, is that this will all happen over the next couple of months. The ARM decomposition should be done in August, and the Azure module rename will happen in September.

del.icio.us Tags: ,,

Thursday, June 25, 2015

Azure Infographic

Microsoft has published a cool infographic on Azure which you can get from http://azure.microsoft.com/en-gb/documentation/infographics/azure/

image

This infographic provides a simple overview to Azure features, Azure services and notes typical use cases. The document is actually PDF file which means you can scale it up or down. I love this diagram as it shows all the key features of Azure. Plus it's up to date!

del.icio.us Tags: ,,

Wednesday, June 24, 2015

Passing the Azure 70-532 Exam

I just saw a neat post describing how to study for, and pass, the Azure 70-532 Developing Microsoft Azure solutions. If you are planning on taking that exam, I suggest you see @shahedc's recent blog article: http://wakeupandcode.com/azure-70-532-study-guide/. Lots of great advice!

del.icio.us Tags: ,,

Tuesday, June 23, 2015

New Azure Pricing Calculator

Microsoft produced a basic pricing calculator to help Azure customers. But as you can see here, customer feedback on this calculator was not particularly positive. In the Azure training I do, I find partners too found this old calculator not overly outstanding.

But, MS has listened and has begin rolling out an entirely new Calculator. So far, there's a new calculator for Virtual Machines which you can access at: http://azure.microsoft.com/en-us/pricing/calculator/virtual-machines/. The VM calculator looks like this:

image

This is a distinct improvement – I look forward to seeing further improvements in the calculator.

del.icio.us Tags: ,

Friday, June 12, 2015

Calling Console Applications from PowerShell

In some recent training, I challenged the attendees to 'throw away' Cmd.EXE and to use the PowerShell console for everything. A good concept, but they challenged me back with: But what about all those commands I used to use – I can't use them any more, such as Ipconfig. That caused them some concern.

But: it turns out that Windows console applications run pretty much just fine under PowerShell. While I prefer using GIP than IPconcig, the later sure is a lot faster and I confess to using it when I just can't stand to wait GIP to finish up it's work. Its' great that these commands just work in PowerShell - just about every Windows Console application runs just fine, although there are some exceptions (and work arounds!).

The first exception is where PowerShell parses the command's parameters and recognises some characters in the command invocation as special PowerShell syntax, rather than the syntax of the command itself. For example, BCDEdit.exe used a Guid, enclosed in "{}" to represent different boot entries – PowerShell sees the guid as a script block , not as some text that can be parsed by the command and thus fails. Most of the misbehaving commands can easily be tamed by using the trick I showed in my blog article: http://tfl09.blogspot.co.uk/2012/08/taming-wild-console-applications-in.html – just use the –% characters as the first text after the cmdlet name (following by the rest of the command's normal parameters).

The other exception is that Interactive console applications are not supported from the PowerShell ISE.  To get around this, just  launch the console application using "Start-Process <console application>" command. This launches the application in a new windows.

Yet another reason to stop avoid learning PowerShell today!

del.icio.us Tags: ,

Sunday, May 24, 2015

Explore Cloud Storage with CloudXplorer

I've been working a lot with Azure Storage – creating some cool scripts/functions to demonstrate the use of Azure storage as well as managing my storage across several subscriptions. The lack of tooling has been a bit of a difficulty – the Azure Storage Explorer (on CodePlex: https://azurestorageexplorer.codeplex.com/) works, but I've found it pretty basic. And it fails to do a number of things for me (mainly remove old VHDs created during demos).

Today I found a new product: CloudXplorer, from ClumsyLeaf software. A commercial product (US$59, with larger numbers of licenses becoming cheaper per license). The product does, however both work across Azure Files, Amazon S3 and Google Storage! And it's fast.

After downloading and installing it you need to enter your storage account (and storage account keys) and then it looks something like this:

image

You can get the free trial from ClumsyLeaf's web site: http://clumsyleaf.com/downloads/cloudxplorer.zip. It runs on Vista and above, and needs .NET 4. And, as I said, you need an azure, S3 or Google storage

del.icio.us Tags: ,,

Friday, May 15, 2015

Managing Multiple Azure Subscriptions

Like many in the industry, I have multiple Azure subscriptions. When I create Azure resources, such as VMs, they are created in one of those subscriptions. However,  when I issue get-* cmdlets, such as Get-AzureVM, Azure only returns the objects in the 'current' Azure subscription, which can lead to some confusion (where did my VM go??).

Of course, when we look to making life easier for ourselves, we naturally turn to PowerShell. There is a cmdlet you can use to set a particular subscription to be the current subscriptions, which those Get-* cmdlets would then use. But that takes time – plus I seem never to remember the cmdlets and have to go discover the details.

To simplify things, I've written a short function that sets one of the subscriptions as current, which looks like this:

Function Set-CurrentAzureSubscription {
[CmdletBinding()]
Param($SubscriptionNumber)
# Check minimum sub number
If ($subscriptionNumber -lt 0) {return 'Try again'}

# Get azure subs
$Subs = Get-AzureSubscription

# check the upper bound
If ($SubscriptionNumber -GE $Subs.count) {return 'try again'}

# set the sub as current
$Subs[$subscriptionNumber] |Select-AzureSubscription -Current
# and say so
"Subscription [$($subs[$subscriptionNumber].SubscriptionName)] set as current"
}

Set-Alias CAS Set-CurrentAzureSubscription

With this function and alias, I just type: CAS 0 to select the first subscription, and (in my case ) CAS 2 for the final one. Here's a look at using this:

image

As you can see, setting my current subscription causes Get-AzureVM to return different VMs! This function is now part of my $profile.

Tuesday, May 05, 2015

And Another Azure PowerShell Release

The other day, I joked via twitter that if you blink, you would miss yet another new Azure feature. Well nearly! Just 6 days ago, I noticed (and tweeted) that there was a new release of Azure PowerShell. Excitingly, the version was 0.9.0. Lots of changes (a total of 469 separate commits) and loads of new cmdlets. Release 0.9.0 has 625 cmdle5ts and 83 aliases (in service management mode), and 336 cmdlets in Azure Resource Manager mode.

Well, just 5 days later, Microsoft released an updated version of the cmdlets – I am assuming this is a drop especially for Ignite. The new build, version 0.9.1, installs nicely over the earlier build. The new version has 8 additional cmdlets in service management mode, but a total of 448 cmdlets in resource management mode (or 112 new cmdlets!). The new MSI weighs in at 19.9mb!

The main thrust of both 0.9.0 and 0.9.1 have been to add new cmdlets to Azure Resource Manager mode.  This involves using Azure Templates about which is a subject for another blog post!

Veeam FastSCP for #Azure – a Cool Free Tool

Those nice folks at Veeam have just announced a new, cool, AND FREE tool to help you manage filestore on Azure VMs. As most of you will know, It's not particularly easy to get data into an Azure VM and back out. As Veeam's blog explains: there are ways to achieve this, but they do take work. Their new FastSCP tool enabled you to copy local files to Azure VMs and copy files in an Azure VM to an on-premises system.

The tool has some neat features. All copy operations are secure, with no need for separate encryption or VPNs. You can schedule the copy commands. The UI is wizard driven and very easy to use. FastSCP, which as I noted above is in beta, runs on Windows 7 and above and needs the .NET Framework 4, and PowerShell 2.0 or later. You can register for the download here: http://go.veeam.com/azure

One small thing: this tool copies files from and to VMs, it does not support copying files to Azure's Blob or File stores. It would be cool if the final version of FastSCP enabled that!

del.icio.us Tags: ,,

Wednesday, April 29, 2015

Jeffrey Snover AMA – A must watch!

I've just finished a most enjoyable couple of hours watching An AMA (ask me anything) interview with Jeffrey Snover, Microsoft Distinguished Engineer and inventor of PowerShell. Jeffrey and his teams) have brought about some awesome changes in terms of manageability of Windows systems. Anyone who has seen Jeffrey speak, know he is an amazing presenter – always full of interesting stories and a passion for helping us to be successful using Microsoft Tools. He is one of the best speakers at Microsoft, IMHO.

This two-part interview (part 1 here and part 2 here) has Jason Helmick ask Jeffrey a bunch of really interesting questions – ones that I see often when teaching PowerShell. If you've taken any of my PowerShell courses, many of these will not be new, but Jeffrey's spin on the question is absorbing and his vantage point unique. Things like, what were the obstacles he faced delivering PowerShell, is the information about PowerShell V3 relevant to PowerShell v5, why the V1.0 in the $Pshome path for PowerShell V5?, etc. Stuff any respectable IT Pro should know.  My question would have been: Does he still carry the 20 dollar bill? He'll know what that is a reference to!

I highly recommend taking some time to watch these two videos. Doubly so if you want to get a better understanding why PowerShell is the future of Windows management.

del.icio.us Tags: ,