Subscribe: Under The Stairs
http://tfl09.blogspot.com/rss/tfl09.xml
Added By: Feedage Forager Feedage Grade A rated
Language: English
Tags:
azure  bash  cmdlet  cmdlets  create  file  microsoft  module  new  powershell  server  time  version  windows server  windows   
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: Under The Stairs

Under The Stairs



Thomas Lee's collection of random interesting items, views on things, mainly IT related, as well as the occasional rant



Updated: 2017-01-20T13:52:22.820Z

 



WMF 5.1 released for download

2017-01-20T13:52:22.846Z

When Microsoft ships a new version of PowerShell, it issues what they call the Windows Mangement Framework (WMF). The WMF package includes a new version of PowerShell, updated core cmdlets, and includes updated versions of other related components (e.g. an updated WMI).

In a blog post on the MS Site, Microsoft announced that release of the WMF 5.1 package. The blog post makes it clear that WMF 5.1 upgrades Window 8, Windows 8.1, Windows Server 2008 R2, Windows Server 2012, and Windows Server 2012 R2 to the PowerShell, WMI, WinRM, and SIL components that were released with Windows Server 2016 and Windows 10 Anniversary Edition.

If you are using Windows 7 or Windows Server 2008 R2, you should be a little careful installing this package. The installation instructions were changed - so read the release notes carefully. 

It should be clear from the blog post, but if not: if you are using Windows 10 AU or Windows Server 2016, there is nothing for you to do. Those two operating systems ship with WMF 5.1 installed.




Using Get-CimAssociatedInstance

2017-01-18T23:36:47.369Z

Tonight I finally found a use for the Get-CimAssociatedInstance cmdlet. I know what that cmdlet does, but never had a real use case, until tonight.  What I was trying to do was to use the CIM cmdlets to find the logged-on user.  Initially, I searched through the many Win32_Classes and found one that looked promising (Win32_LogonSession). So I tried looking at the interactive logons: Get-CimInstance Win32_LogonSession |         Where-Object LogonType -EQ 10 But that returned me a somewhat unhelpful response: I wanted the username (and the SID). So I searched around a bit and found a class name that looked appealing: win32_loggedonuse. Turns out this is one an associator class. In WMI, the associator associates two other instances in the WMI database. In this case. the associator class associates a Win32_LogonSession with the WIn32_Account that is logged on in that session. So I turned it into a tool :. Function Get-WhoIAm {# Get Account for the loggede on user$Me = Get-CimINstance Win32_LogonSession |         Where-Object LogonType -EQ 10 |           Get-CimAssociatedInstance -Association win32_loggedonuser# Extract useful properties$IAmHT = [ordered] @{}$IAmHT.Account            = $Me.Caption$IAmHT.Description        = $Me.Description$IAmHT.LocalAccount       = $Me.LocalAccount$IAmHT.PasswordChangeable = $me.PasswordChangeable$IAmHT.SID                = $Me.SID$IamHT.CommputerName      = (Get-CimInstance -Classname Win32_Computersystem).Name# Create a new object$IAm = New-Object -TypeName PSCustomObject -Property $IAmHT# And return the Iam objectreturn $IAm} And for fun, I set an alias of WhoAmi - a tool I've used for a decade or longer. With that done, the output looks like this: Happy days with WMI and the CIM Cmdlets. [...]



Building a GUI with PowerShell

2016-12-23T16:55:09.496Z

Many IT Pros are familiar with the concept of using Windows Forms and PowerShell to create a simple. The approach is not always that easy if you are doing it from scratch - automation is very helpful.

Sapien's PowerShell Studio (see https://www.sapien.com/software/powershell_studio for more information) works very well, but it is commercial. And at a price of £389, out of reach to many folks.

I just discovered a cool online site that does a great job of building a GUI with PowerShell - for free: https://poshgui.com/#.  The starting page looks like this:

This is not anywhere near as rich as Sapien's tool, but great for really simple GUI development. Once you get the form right, just copy/paste it into the ISE and away you go!




PowerShell cmdlet documentation is open source - COOL!

2016-12-22T22:29:42.637Z



I was recently teaching a PowerShell course, and we looked at the definition the NAME parameter in Get-Service. It stated that the parameter did not accept wild cards. But it did. That made the demo sub-optimal.

So what's the obvious thing to do? Easy: just fix it!  And you can! If you look at the online version of the cmdlet's documentation (here: https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.management/get-service) the page looks like this:



In the upper right-hand corner is a little button Contribute. You do need to be logged in with a Microsoft Live ID to see the contribute icon.

Clicking Contribute takes you to the GitHub page for this document. All you have to do is to click on the Edit (the pencil icon), make the changes, and create a pull request. The pull request asks the doc team accept your update. Then send it and away you go. The whole process is automated and very quick and easy. The pull request is reviewed before being accepted - and as part of that process, the doc team can ask for something more/different. The process is very slick.

And finally, when you DO have the pull request accepted, your Live ID picture appears on the page. COOL - my face on the PowerShell documentation.



My Ten Tips For Technical Writing

2016-09-04T17:45:21.752+01:00

I have written many hundreds of thousands of words over my career – not only work product, but books, trade publication articles and so on. Over that time, I’ve read far more then I’ve written. And in that time, I’ve slowly developed a set of rules for how I write. Or for how I hope to write! In my career, I have had three great writing mentors: Keith Burgess, Roy Chapman, and Susan Greenberg. Keith was a partner at what was then Arthur Andersen Management Consultants who I worked directly throughout my time there (and was to work for again 20 years later). I did work for Roy over the years, he was a master at writing. Susan Greenberg was an amazing instructional designer at Microsoft and a great teacher. All these people strove for excellent writing – and each helped me to learn to write better. My ten rules are really pretty straightforward. Some can easily be converted in to muscle memory – your hands just type better text. And when I see some of my rules broken in other people’s writing – it drives me nuts. Those authors who have had me as an editor will recognise some of them! So here are my ten rules for better writing: Avoid future tense  This rule has a couple of benefits. Some languages deal with future tense differently to English – present tense is easier. Also future tense may make the writing harder to understand. For example: if you say “clicking on the foo button will make bar happen”. So the question is when will that happen? Is it immediate? Will bar happen in a minute/hour/day? Better to say: ‘Clicking on the foo button makes bar happen. Avoid passive voice Passive voice is, to cite Wikipedia,a grammatical construction where the noun that would be the object of an active sentence appears as the subject of the sentence.  Active voice, for example “Our company builds the best widgets whilst in passive voice it’s “The best widgets are built by our company. Sentences with passive voice add words to the sentence (6 vs 8 words). They can also make the reader work harder to understand the intended meaning. No split infinitives Yeah – I know: To Boldly Go and all that.  But an infinitive is a single idea – splitting it makes understanding more difficult. You should avoid that. What is it, so what  This is one of the lessons Susan Greenberg beat into me. It’s simple really: when you are writing about something, you should explain what it IS, before telling us why it matters. I really hate reading about some product or technology where the writer spends the first few paragraphs telling me why it was cool, without ever explaining precisely what ‘it’ actually is. Define your terms, THEN tell me why I need this product. Organise carefully I learned this lesson watching Keith Burgess. When you are writing a client report, or a magazine article, you have a purpose. That purpose could be to justify a project, or to explain a product or product feature. You need to organise your thoughts carefully, progressing from premise through to conclusion. You are taking the reader on the journey. We all know authors who veer widely off topic with annoying regularity. Decide on 2nd person vs 3rd person This is about how you are talking to the reader. Do you say: “You do X to make the Y feature work” or “The user does X to make the Y feature work”.  I prefer to directly to the reader, you, vs some one else, eg the user, the manager, the IT Pro. I like to talk directly to the person who is reading. Gender neutrality - or not This is one where political correctness can abound. I see some writers trying to be cute and always using ‘she’, or ‘chairwoman, or those being politically correct, eg the chairperson. I have views here – but the level of neutrality you need will depend on the target audience. You do need to be sensitive to your audience The Oxford Comma This one is subjective – some ignore it, others insist. It’s called Oxford [...]



Windows 10 Anniversary Edition–You’re Fired!

2016-08-03T19:42:44.667+01:00

Like many, I was excited about the progress that Microsoft made with WIndows 10 and was looking forward to running the final version! Sadly, my enthusiasm was short lived.

I have a nice home workstation: dual processor/ hex core, 96gb of ram and 4tb of disk – and a nice pair of modern 24 inch TFT panels. I have two other systems of similar size under my desk – these run Server 2016 TP5. All three systems are connected to the twin TFTs via a nice Lindy 4 port HDMI/USB KVM switch. The two servers use just one screen, whereas the workstation has one output going to the KVM, the other direct to the right screen. Having two screens has become not only natural, but important for work. Being able to have three large windows open is now normal practice.

So, last night I saw there was an update and I agreed. Go for it, I thought. The ‘upgrade’ took nearly an hour all told. But then I got the logon screen. After logon I got my first bit of bad news: Only one screen. The other two systems on the KVM switch work perfectly – the Windows 10 machine would not project to the second panel. I tried all the normal tricks of plugging things in, power cycling everything, etc. But I carried on.

Then the next bit of bad news: application compatibility. First, Network Monitor – AE gave me toast saying it was not supported. NO problem, I thought – I have Wireshark. Second, Foxit PDF reader started behaving oddly. If I double clicked a PDF in a mail in Outlook, the file opened, but Foxit immediately crashed.

Then came the proverbial 3rd strike. I fired up a VM (The old box ran around 10-12 VMs albeit not at the same time). I double clicked on the VM, and the VM Connect box errored out. I tried again. Error.

Sorry Microsoft, losing the second screen. having app compatibility issues with key tools, and no being able to see inside my VMs is simply unacceptable. I can not accept the downgrade in functionality. Frankly, for me an OS is just a tool. The changes for me are mainly cosmetic – except of course for PowerShell (but I can get that separately anyway).

So I reverted. Foxit works, as does Netmon. VM Connect works just fine. And I have my two screens back. Sorry Microsoft. Sorry Windows 10 Anniversary Edition, but You’re Fired.




Backing up SSD Disk In Azure

2016-06-18T16:33:51.426+01:00

Given all the coverage of the LinkedIn purchase, you may have missed the latest feature update in Azure: you can now backup data stored on Azure hosted SSD Storage using Azure backup.

Azure Premium storage allows you to provision SSD disks in the cloud – which naturally speeds up I/O operations and improves performance of workloads like SQL Server. Unlike traditional (i.e. spinning disk) storage in Azure, you pay for the disk you provision irrespective of how much you use. Traditional storage is billed based on the amount of storage actually used.

Like just about every feature area in Azure, Premium Storage is an evolving story. Last month, Microsoft announced that you could use Azure Site Recovery to replicate to Premium storage.

The most recent announcement means a VM using Premium Storage for storing VHD and other data can now be backed up with Azure backup. There is some documentation on the Azure documentation site: https://azure.microsoft.com/en-us/documentation/articles/backup-azure-vms-first-look-arm/.

With this updated feature, you can now fully backup any Azure VM, whether V1/ARM irrespective of storage used (spinning disks vs premium SSD storage). You can specify the replication options to enable LRS vs GRS, define the backup goals, set policy and specify what to backup. Backup is pretty straight forward!

Technorati Tags: ,



Windows Server 2016–Coming Soon (and a free e-book)

2016-06-18T16:15:37.667+01:00

Windows Server 2016 is coming soon. While Microsoft has not issued a formal release or launch date yet, the updated server OS is due out sometime in the coming months. As I understand it, we are likely to see one further technical preview before RTM. I’m expecting RTM to be over the summer and expect to be able to download it from MSDN soon after. We’ll see how accurate my guesstimates are – and no I have NO inside information.

A sign that the new OS is coming soon is the release of a new e-book: Introducing Windows Server 2015 Techical Preview. It’s a bit dated (it was released in April) but has great details of the key new features of Server 2016, including Nano Server, Containers and the huge host of other updated or new features. I have downloaded the PFD and have been reading it on my train journeys to/from London.

Technorati Tags:



Finding Type Information in PowerShell

2016-05-18T20:12:08.188+01:00

On frequent occasions, I find myself using a cmdlet and needing more information about the objects that cmdlet produces. The details are in Microsoft’s MSDN library, but it can be hard to use the GUI to find it. Fortunately, I found a cool way of dealing with this. I found the trick on the Internet but I really can not remember where I found it.

The trick is simple: I use some Type XML to extend all objects with a new script method called MSDN. If I create an object – I can assign it to a variable and just call the .MSDN() method on any occurrence.  Suppose I did a Get-ChildItem against the Certificate Provider and needed more details on the object returned. I just do this:

$Certs = Get-ChildItem Cert:\CurrentUser\My
$Certs[0].MSDN()

The MSDN() method, something I’ve added in, then brings up Internet Explorer and nvigates to the appropriate page in the MSDN library. Which is: https://msdn.microsoft.com/library/System.Security.Cryptography.X509Certificates.X509Certificate2.ASPX.

But how did that method come about – you might ask! Easy – it’s just a bit of type XML I add to each system I use. I just add an xml file and reference it in my PowerShell profile. The XML file looks like this:


 
    System.Object
   
     
        MSDN
       
     

   

 

I have saved this into a file (I saved it as c:\foo\my.types.ps1.xml) then in each PowerShell profile I just add it in:

Update-TypeData -appendPath C:\foo\my.types.ps1xml

And from then on, you can just use the MSDN method on just about any type. It’s not perfect – sadly there are types/classes that do not appear documented in MSDN (or at least now where this little XML trick can find it).

If you know where this came from, Please comment – I just can’t remember where I found it!




Some Cool Writing Tools I Could Get Used To!

2016-05-18T18:29:18.007+01:00

As someone who blogs, and contributes to a lot of web forums, my writing skills matter. I want readers to digest what I say, without the text sounding like I'm talking to a 5-year old. The technical content of a lot of what I post makes that even more challenging. I’m sure I am not the only person who cringes when I see a typo or a bit of appalling grammar in my output.

Today, I came across an interesting page from StumbleUpon, called ‘3 Simple Writing Tools that will blow your mind’.  I did find the inconsistent use of capital letters in that headline to be amusing. But the content was good – and very useful!

The first tool is Headline Analyzer – which does what it says. You type in an article’s headline to the page (http://coschedule.com/headline-analyzer) and then the page analyses the headline for you. It shows common, uncommon, emotional and power words in your headline. Increasing the number of uncommon or emotional words can improve the headline. The page also shows how your article might appear in both google and email! If better headlines increase readership, then so much the better! I’ve bookmarked this page!

The second tool is Hemingway – a tool at www.hemingwayapp.com. You paste your article headline/text into the page, and your text is analysed for thinks like use of passive voice, or for phrases that have simpler alternatives. Running this article’s draft through Hemmingway showed some sentences/phrases that could be improved. This is another page I have bookmarked.

The final tool is called Grammarly. This is a chrome plugin that checks your text as you type into text boxes on Web pages. I installed it, and instantly the SpiceWorks pages give me this nice editor. This tool is free, and I’m already hooked!

Tools like these are a gas!




Are Merrill Lynch Thieves?

2016-04-27T19:28:48.374+01:00

In my early 20s, round about 1973, I received a phone call from Merrill Lynch – it was a stock broker who was looking for the ‘other’ Tom Lee. I lived in Michigan and there were two of us with the same name. I occasionally got calls for him. Anyway – while the call was not for me, I was interested. I was in my first job after university and wanted to start investing for my future. My great grandmother was a big fan of investing and told me I should do so as young as possible.

So following that call, I opened a Share Builder account and started investing. The idea was you sent them money and they bought fractional bits of shares and credited your account. Dividends were re-invested. It was sweet – I put a few dollars in on a fairly regular basis and slowly my portfolio grew. It was a nice programme and I invested consistently.

In 1975, I moved to the UK – but mail does get here from the US, and I managed to organise change of address with no problem. With currency control in effect at that time, I was unable to invest more – but was happy with the growth due to dividends. I hoped, one day, to be able to invest more.

In 1981, I joined what was then Arthur Andersen (now Accenture) and was forced to sell all my shares – except for one that I did not sell. I had a few shares of IBM and wanted to keep those. I was successful.

Since then, the shares just grew – each quarter, the dividend bought more bits of shares and, along with a few stock splits, I ended up with around 320 shares by last year. And although IBM has gone through a rough time – this is to me a lot of money that I planned to use in my retirement. I reached 65 last summer and was considering what to do with these shares. I did not need the money urgently so was happy to wait.

But then Merrill Lynch ‘helped’ me. In December 2015,they took all the shares, closed my account and now they refuse to talk to me. They claim they tried to contact me in August 2015, but I never received any communications. They have been utterly unhelpful at tracking down my missing IBM shares.

They claim the money has been given over to the state of Delaware under an escheat scheme. Well – Delaware has no record of any money or shares given over. And Merrill Lynch have refused to talk to me saying I should talk to Delaware.

Bottom line: I have lost 320+ shares of IBM (worth today roughly $47k). They refuse to help – and just refer me to Delaware (https://delaware.findyourunclaimedproperty.com/). Having spoken to the folks in Delaware – they know nothing about it.

What can I conclude but that Merrill Lynch are thieves and crooks? Maybe that’s strong language. But what do you call a firm of bankers who take your money and in effect laugh in your face and tell you to get lost? I am gutted to have lost that much money due to bankers who seem to be able to get away with it.

If you know any one at Merrill Lynch, feel free to point them to this blog post.




Windows 10 Build 14328 – Two Interesting PowerShell Changes

2016-04-23T13:42:23.391+01:00

I’ve just updated my text Windows 10 test VM to the latest Insider build, 14328. Needless to say, one of the first things I did was to open up PowerShell and look at $PSVersionTable. And when I did so, there are two interesting changes. Here’s what I see:

(image)

Note there are two interesting changes:

  • First, the $PSVersionTable variable has a new property: PSEdition. On my VM, as you can see, this is set to Desktop. The Latest Windows Server 2016 has an older build of PowerShell, and this property does not exist, nor does it exist on my main workstation (running 5.0.10586.122).
  • Second, note that the PowerShell Version number has changed to 5.1!

Taken together, it looks like Microsoft will release an updated version of PowerShell with the Windows 10 Anniversary edition. And at a wild guess, I suspect MS will ship that version of PowerShell in Windows 2016 when that ships.

What remains are two questions: what is new in 5.1 (or what WILL be new when it’s ‘released’), and what’s up with the PSEdition property? It also somewhat begs the question around what is the ongoing strategy surrounding version numbers? What is the effective difference between 5.1 and 6.0? I’d just like to understand the PowerShell team’s version numbering strategy.

So far as I can tell, there’s nothing I can see new in this build of PowerShell (aside from the additional property. But I’ve only had this new build up for an hour. More fun later today, no doubt!




Bash on Windows– 10 Things I Learned Today

2016-04-07T20:31:07.642+01:00

I’ve been playing today with Bash on Windows 10. I blogged earlier about how to install it. Now to getting down to use it. I spent a few hours today as a NEW to Bash user and found some differences. If you know Linux,  you may find some of these obvious but they do represent a difference new to Bash folks will find.

1. BOW is case sensitive  LS is not the same as ls. Windows is not case sensitive, so LS and ls are the same.

2. Getting help for a command is different and inconsistent between commands. In some cases it's -h, some times --h, or --help, etc. Each command has its own way of providing help.    

3. The Unix MAN help system is alive and well in Bash. Type man for help. However, this takes you into a pager, from which you type q to escape.

4. You don’t have a graphical text editor in Bash. But you do have VI, and you can easily install emacs (apt-get install emacs23).

5. The Linux and Windows file systems are different. Windows has no single root, but a bunch of volumes C: d:, etc. With Linux there is one unified filesystem '/' with everything underneath it. 

6. You can see the windows file system from bash /mnt/c is c:, /mnt/d would be d:, etc. But interop is limited. It would be nice to be able to edit, say, over in Windows but use over in bash. That doesn't really work fully. You can, for example, mkdir /xxx from the bash side, and that folder shows up in windows. But create a file in windows and you can't see it from bash. I suspect this is a work in progress.

7. No GWMI Win32_Processor, instead cat /proc/cpuinfo , or  grep Intel /proc/cpuinfo (nb grep intel /proc/cpuinfo fails! - see rule 1)

8. The error messages are quite different.

9. Type Man Man and you can see where PowerShell help ideas came from!

10. Type the wrong command and you can often be told which where to find it (eg, type lsf and see what it offers you)

And since I can’t count well,

11. Getting packages is different - You use apt-get. apt-get install emacs, for example. PowerShellGet is modelled on APT-Get, it feels!

This is fun!




Installing BASH on Windows 10

2016-04-07T16:34:56.735+01:00

Well – I now have Bash running on Windows 10. Turns out to be pretty easy! The first thing to do is to get the latest Insider build – you need 14316. This build is not yet available for ISO downloads (although I suspect that that will come soon), so you need to get the update. You just go to the Settings setting and change over to get the Insider builds (make sure you specify the fast ring) and let it download. Something like this:     After downloading the update and doing a reboot brings up the new build. After tuning on the developer features, you then go over to Control Panel and Select the Windows Subsystem for Linux ( Beta). Like this: Once WSL is installed, you get the obligatory reboot, then just run Bash. The first time you run Bash, it lets you know that you need to load the Bash Shell itself:     Once that is done, you can start typing Linux commands:   But here’s is the screen shot I love (and a tip of the hat to Paul Adare): Bash on Windows. Real Bash. And all the tools. Including apt-get. WOW – if I did not know better, I’d wonder if Hell had frozen over.[...]



Bash on Windows

2016-04-02T20:09:54.515+01:00

Hell has truly frozen over. Or something like that. At //BUILD this week, Microsoft announced Bash on Windows. I was listening to the keynote over the Internet and watching Twitter. As I listened to the keynote, I kept asking ‘why?’  Jeffrey Snover tweeted, to the effect that I’d get it eventually. As usual he was right.

I get it, now.

I read a great blog post (http://www.hanselman.com/blog/DevelopersCanRunBashShellAndUsermodeUbuntuLinuxBinariesOnWindows10.aspx) and watched two videos today that helped. The first video is an overview to the feature, with Rich Turner and Russ Alexander (https://blogs.windows.com/buildingapps/2016/03/30/run-bash-on-ubuntu-on-windows/). It explains the feature well! The other one was a panel discussion from the BUild conference narrated by Scott. Get this at: https://channel9.msdn.com/Events/Build/2016/C906.  And here’s another good blog post from Canonical’s Dustin Kirkland: http://blog.dustinkirkland.com/2016/03/ubuntu-on-windows.html.

So why does this matter and what’s the big deal.

Let’s start with how the feature is architected. When you run Bash on Windows, AKA BOW, you are running a pure Linux (Ubuntu) userspace. It is bit for bit Ubuntu, with the Linux kernel replaced by a new Windows subsystem that implements the Linux system calls. It looks like, acts like, and to all intents is Linux. On Windows. I find the solution quite elegant.

So who would want it? Well – Microsoft via UserVoice, concluded there were a lot of  developers who were developing apps for Linux server, for example a Ruby on Rails based web site.  They use Emacs and a variety of tools to edit the source code, check it into a repository (Git), and push it up to the cloud (azure). They use other tools to do the building, unit testing, etc. The open source environment is rife with tools that a canny developer can leverage.

These Linux server devs (I hesitate to use the acronym LSDs) currently use Linux client systems. WIth WOW, they can now use ALL the tools they used to, from a command prompt they know, leveraging the Linux package community as they always have – but you are running all that on top of Windows.

That enables a couple of things. First, it will simplify the management of the developer workstation. It can now be Windows (with AD, GPOs, etc, etc), but with the power to run the developer’s normal workflow unencumbered by Windows. But at the same time, the dev can Alt-Tab to Outlook, the Edge browser, leverage Office and that huge library of windows applications. The best of two worlds.

Another interesting aspect – it turns the developer’s desktop into a Windows License. Linux at the from door, Windows by the back door. Or something like kthat

I like the concept. It’s certainly NOT for everyone – but I can see there there is a market.  I suspect that, cool as this is, there is a lot more to come here.




The AzureRM module–Post the Great Renaming

2016-03-01T09:48:36.095Z

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



Get-AzureResourceGroupGalleryTemplate is missing

2016-03-01T09:26:22.251Z

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 casew. It’s not just the portal that is so different, 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. 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-DateWrite-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 templatesTry   {         $AllGalleryTemplates = Invoke-WebRequest -Uri $GalleryUri | ConvertFrom-Json      }Catch {         "Error invoking Call to Azure Gallery"      }#     Write verbose return information$EndTime = Get-DateWrite-Verbose "Finished at $EndTime"Write-Verbose "$(($EndTime-$StartTime).totalseconds) seconds elapsed"Write-Verbose "Templates returned: $($AllGalleryTemplates.count)"#     And return itReturn $AllGalleryTemplates} Set-Alias Get-RGTemplate Get-AzureResourceGroupGalleryTemplateSet-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[...]



SSD Life Time Measurements

2016-02-01T11:57:01.384Z

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.




Introducing the PowerShell ISE Preview

2016-01-30T15:06:14.796Z

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! (image) . 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!”"




PowerShell’s Get-Random Cmdlet–a curiosity

2016-01-15T18:11:52.575Z

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.




Open Live Writer

2016-01-04T11:15:06.495Z

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.




Symbolic Links in PowerShell V5

2015-12-19T20:20:44.570Z

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 FolderSet-Location c:\Foo\SlTestmkdir C:\Foo\SlTest## Now a subfoldermkdir C:\Foo\SlTest\Real## And a real doc1..10 | Out-File c:\Foo\SlTest\Real\foo.txt## Now create a symbolic linkNew-Item -ItemType SymbolicLink -Name .\virtual -Target .\real   ## And a symlink for a fileNew-Item -ItemType SymbolicLink -Name .\SYMfoo.txt  -Target .\real\foo.txt## You can also create a hard linkNew-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: PowerShell,Symbolic Link [...]



Azure AD As A Service

2015-10-19T17:22:39.373+01:00

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!




Announcing: PowerShell PowerCamp – Oct 17-18 – London

2015-09-15T17:30:30.491+01:00

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 eve[...]



Azure PowerShell – Some Changes and Some Good News

2015-09-01T15:04:47.441+01:00

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)