Showing posts with label documentation. Show all posts
Showing posts with label documentation. Show all posts

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.

Sunday, January 19, 2014

Windows Server 2012/R2 Documentation-in PDF

Thanks to a post over on SpiceWorks, I’ve discovered that Microsoft has just published a full PDF of all the Windows Server 2012 and Windows Server 2012 R2 documentation. This represents the entire contents of the TechNet library on these two subjects. You can download from here: http://www.microsoft.com/en-gb/download/details.aspx?id=41182

Before you go rushing off to download – this is a big download. The pdf file itself is 110.9 MB. And definitely think hard before rushing off to print it out – it runs to 7970 pages. That’s around 8 reams of paper (or around 2 boxes). Not to mention the cost in toner!

Despite the size, this is a great document to have. I’ve loaded it onto my laptop and my Surface devices.

Technorati Tags: ,

Tuesday, November 23, 2010

Microsoft Releases Lync Documentation

Continuing the tradition started with OCS, the Microsoft UC team have released a mountain of documentation for Lync 2010. As with OCS, there’s both a set of detailed documents, and a .CHM (complied HTML Help file) with all the documents in one place. Even better, you can get the detailed documents as downloadable .DOC files and as web documents you can read on line. A nice job!
To get to the detailed documents, you can go to this page in TechNet: http://technet.microsoft.com/en-us/library/gg398616.aspx. The .CHM file is at: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=9720c3f1-ddd4-426b-b98a-f1205561ce00&displaylang=en.
The UC team is to be congratulated for producing such comprehensive and accessible information. If only ALL software teams were so good!

Tuesday, October 05, 2010

Failover Clustering Cmdlets–Great Documentation

I just came across a really great page that documents the Failover Clustering Cmdlets in Windows Server 2008 R2. This page from Jose Barreto’s blog has a super diagram showing a model of these cmdlets. This model shows a box for each noun used by the cmdlets. Inside each box you see the the verbs that operate on the the noun, as well key attributes of a specific instance of that noun.  Thus for the Cluster noun, you see two identifiers (-ClusterName, –Properties) and the supported verbs (Get, New, Remove, Stop, Start, Test). Then you get links between the various objects showing how they relate to each other.  Then you get links between the nouns/objects. In other words - a good old fashioned data model.

For any cmdlet set, verb names are going to be constrained, e.g. get, set, new, start, stop, etc. So to learn a set of cmdlets, you need to focus on the nouns. Once you know the nouns, you will know the cmdlets (well for the most part). The diagram does a great job of showing how the the individual clustering objects (i.e. the nouns) relate to each other. What this diagram does so well is that it also shows the key objects involved in fail over clustering and how they relate since the cmdlet nouns are the key failover clustering objects.

Microsoft should document all cmdlet sets like this!

 

Sunday, October 03, 2010

PowerShell in Windows–A Nice Feature List

The TechNet folks have produced a nice list of PowerShell features offered by Microsoft. This page has a list of all the features offered plus links to information about how to get the individual features. The list looks reasonable complete – and is a good jumping off place for learning more about PowerShell in Windows.

Monday, March 01, 2010

PowerShell Documentation Community Review

The Microsoft PowerShell doc team is looking for volunteers for the third documentation review cycle. This cycle is focusing on the needs of new and intermediate PowerShell users. And if you speak a language other than American or English, then they’re doubly interested. Shay Levy has some more details over on his site.
If you care about the documentation, particularly non English language material, then contact superstar and writer extraordinaire June Blender (JuneB@Microsoft.Com) or PowerShell community superstar Marco Shaw (Marco.Shaw@Gmail.Com). Please help make the documentation better.