Another company, EMC, joins the ever lengthening list of 3rd party firms that are incorporating PowerShell, or a PowerShell interface into their products. If you go over to http://velemental.com/2014/07/07/powershell-module-for-emc-protection-rest-api/, you can see more details of the REST api and the cmdlets.
Thomas Lee's collection of random interesting items, views on things, mainly IT related, as well as the occasional rant
Friday, November 14, 2014
Wednesday, November 12, 2014
Microsoft takes .NET Open Source AND Cross-Platform
Microsoft has this week announced that it is providing the full .NET Server stack into Open Source. This includes ASP.NET, the .NET compiler, the .NET Core Runtime including the Framework and Libraries. This Microsoft says this should enable "developers to build with .NET across Windows, Mac or Linux". For the details, see http://go.microsoft.com/fwlink/?LinkId=518340.
And as if that were not enough Open Source goodness, Microsoft also announced Visual Studio Community 2013 – a free, fully featured version of Visual Studio including full extensibility. Developers, or anyone else interested, can get started with Visual Studio Community 2013 HERE.
Wow!
Tuesday, November 11, 2014
CBT Nuggets Publish a Course for Microsoft Exam 70-337
I see that CBT Nuggets have just announced the release of their video training course Microsoft Lync Server 2013 70-337.
This course covers all the key parts of the syllabus for the 79-337 exam along with some exam preparation tips and a case study to help you further prepare.
I've not yet looked at the videos in the course, but CBT Nuggets material is usually of a good standard. I'd be interested in any feedback.
Monday, November 10, 2014
Writing Classes With PowerShell V5-Part 1
As I noted in previous blog posts (here and here) one of the many cool features coming with PowerShell V5 is the ability to develop Classes and Enums using PowerShell. in Monday's blog post, I showed how you could create an Enum, one important construct useful to creating classes.
Before I look at creating classes with PowerShell V5, it might make sense to go over what a class is and what creating them means. Many PowerShell users may be under familiar with the concepts involved.
Classes
The first thing to cover is classes. But what IS a class? A class is the definition of an object. In PowerShell everything you do relates to instances of objects that belong to some class. If you issue Get-ChildItem on the file system provider, you get zero, one, or more object occurrences, or instances, of either the System.Io.DirectoryInfo or System.Io.FileInfo classes. The number 42 is an object of the class System.Int32,
The Class defines the object (and occurrences of that object). Each class has a number of members. These include constructors, properties, and methods. The constructor is how you create a new class instance (creating a System.Io.Fileinfo object (instance) pointing to c:\foo.bar.ps1). Properties are attributes of object are actions you can apply to the object, such as the name of a file. The properties and methods of a class can be either static (belonging to the class) or dynamic (belonging to a class instance). This is a difference new PowerShell – see below for more on the difference.
Constructors
A constructor is code that creates a new instance of the class. Constructors can take parameters that describe the object instance to be created. You can also overload constructors – creating more than one constructor with different sets of parameters. In the System.Net.Mail.MailMessage class, you can see 4 different constructors; one takes no parameters, while the other three take different sets of parameters, as you can see in MSDN. Each constructor creates an object instance (a mail message) but with different properties.
Properties
A properties is some attribute, either of the class itself or of an class instance. For example, the class [system.int32]. Each property has a type and this can be a value type (such as a string, or an integer) or a more complex object. An occurrence of the System.Net.Mail.MailMessage class, for example, has a simple Priority property that takes a string (Low, High, Normal). It also has a property, To, which takes an object of the class System.Net.Mail.MailAddresss. The point here is that an object instance (a mail message) has a property (to) that itself is an object which has properties (e.g. DisplayName). Of course, that property too could be an object etc etc (although in the case of System.Net.MailAddress it doesn't!).
Methods
A method is some function that the class is capable of performing – either on an specific instance (a dynamic or instance method) or based on the class (a static method). Dynamic methods usually do something to the instance, while static methods do something that relates to class itself. The System.Int32 class, for example, has both static and instance based methods. Individual instances of the the System.Int32 class contain methods that convert the instance's value to another form (e.g. Boolean, or System.Int64, etc). Those dynamic methods work on the the instance of the class. The ToString method on instances of System.Int32 converts the value into a nicely formatted string, with the help of a CultureInfo object, like this:
Static Methods and Static Properties
One concept that many new-to-PowerShell folks find harder to understand is concept of static (vs dynamic of instance) methods and properties. A static method is a method that does not make use of a specific instance of the class. Instead it works by doing something class related. The System.Int32 class has a neat static method, Parse. The Parse method takes a string and either parses that string into a 32-bit number or raises an exception if it can't correctly parse the string. The PowerShell Syntax to invoke a static method is: [<class name>]::methodname(<array of method parameters, or nothing>]. For example:
[System.Int32]::parse('42')
The System.Int32 class also has static properties or properties of the class. For example, MaxValue is the largest value that a System.Int32 can hold, while MinValue is the smallest value. In PowerShell, the Syntax for static properties is: [<class name>]::<propertyname>.
Here is an illustration of static methods and properties.
As you can see in this screen shot, the Parse method parses nicely the string '42' into a 32-bit integer. But the string ('4223452354234523452345235234'') could not be parsed and the Parse method threw an exception, the Overflow exception, as you can . You could use the Parse method inside a Try/Catch block to, for example, validate that some value passed in from a user is of the right form (i.e. a 32-bit integer) and catch and handle any exceptions to that validation.
A static property is some property related to the class not an instance. System.Int32 also also has some static properties, including MaxValue (the largest 32-bit integer), and MinValue (the smallest integer).
Creating Object Instances
PowerShell users typically create the object instance by using cmdlets (or functions, aka script cmdlets). Thus you use Get-ChildItem cmdlet and get instances of System.Io.FileInfo and/or System.Io.DirectoryInfo classes. In most cases, you process the objects instances by using cmdlets for example using Set-ADUser to update user information in Active Directory. Best practice says to use cmdlets where you can and only then drop down into lower level code.
There are three ways you can create new instances of an object (class). The first is via a cmdlet, but in the absence of cmdlets/functions, then you can either use a static method of the class or use the New-Object cmdlet and specify the class of which you wish to create an instance. One example is the class System.Guid, which it defines and manages guids. There are no cmdlets to manage this object type. If there had been, then you would most likely have a New-Guid cmdlet to create a new guid. Since that cmdlet does not exist, to create a new guid, you use a static method, like this:
.
The other way to create new instances is to use the New-Object cmdlet. This cmdlet uses the class constructors available and matches the parameters you specify with the various constructors. For example, you can create a new instance of the System.Mail.Mailmessage class using one of four constructors. To Create an empty mail message, you would do this:
# Create an empty massage
$EmptyMsg = New-Object System.Net.Mail.Mailmessage# Create a message from and to
$To= 'tfl@psp.co.uk'
$Fm='doctordns@gmail.com'
$MailMsg = New-Object System.Net.Mail.MailMessage $Fm, $To
So What?
In Windows, Microsoft and other vendors have provided thousands of cmdlets, but as yet, there is not full coverage of all the objects in the .NET framework. Thus if you need to use objects of those types (belonging to some less well known .NET Class). A good example is localisation. If you want to present a price in say US$, Norwegian crowns and UK Pound sterling. Assuming you know how to use the ServiceEx web services, the script looks like this:
# Get Curency conversion rates
$From = 'GBP'
$Tous = 'USD'
$Tono = 'NOK'
$CurrencyConvertor = New-WebServiceProxy "http://www.webservicex.net/CurrencyConvertor.asmx?WSDL"
$USrate = $currencyConvertor.ConversionRate($from,$tous)
$NOrate = $currencyConvertor.ConversionRate($from,$tono)
# Calculate price
$priceUK = 12345.669
$priceNO = $PriceUK * $NOrate
$priceUS = $PriceUK * $USrate# Convert to nice strings
$usinfo = [System.Globalization.CultureInfo]::CreateSpecificCulture('en-us')
$Noinfo = [System.Globalization.CultureInfo]::CreateSpecificCulture('no-nb')"The UK price is: $($PriceUK.tostring('c'))"
"The NO price is: $($priceNO.tostring('c',$noinfo))"
"The US price is: $($priceUS.tostring('c',$usinfo))"
And the output looks like this:
Pretty easy, when you know how to manage .NET classes and can use XML web services. The .NET framework contains a wealth of classes that have value, depending what you are working with. Being able to just reach out and grab them, when there are no cmdlets, provides you with a lot of power. Plus, if you understand what is going on with objects, troubleshooting scripts becomes easier – if nothing else, the error messages may make a bit more sense.
In the next article I'll look at actually combining the information presented here with how to create these things using PowerShell V5.
PowerShell Desired State Configuration – More Resources
As noted on the PowerShell Team Blog, Microsoft has published many new experimental resources for Windows PowerShell in the form of the DSC Resource Kit Wave 8. This latest release brings the number of rerources available to over ONE HUNDRED (138 for those of you who are counting – a 53% increase from the earlier release).
The sheer number of resoures now available is staggering – and I expect the pace of delivery here to continue as the team approach RTM for PowerShell 5 and Windows 10.
As Clifton Chenier sings: Laissez les bon temps roulez.
Tuesday, November 04, 2014
Writing Better PowerShell Scripts with ISESteroids
I’ve been working a lot recently with a nice package called ISESteroids. As an ISE user, the name got my attention before anything! As the name kind of indicates, the package improves PowerShell’s Integrated Scripting Environment.
So what IS ISESteroids? ISESteroids is a commercial module that you add into the ISE converting the ISE from a good development tool into a much better one. My view is simple: ISESteroids makes me able to write better code, more legible code quickly and easily.
Installing ISESteroids is trivial. Just download the package (it comes as an archive), unblock the archive (after download, right click the archive, select properties then select unblock). Then create an ISESteroids folder under your modules folder, and copy the contents of the archive there. It should look something like this:
Once the module is in place, you just need to add a line to your ISE Profile:
Start-Steroids
The first time you run this cmdlet, you have to accept the license agreement, but after a second or two, you can start to experience the added value ISESteroids gives you.
But what is that, I hear you say? There were several things I noticed after first installing ISESteroids. The first of which is that the whole UI changes. The top part of the ISE has the original tool bar expanded and with a second pull down tool bar with more tools. Plus the tool bar at the bottom of the ISE window has been enhanced and now includes a community information feed. This bottom tool bar also has a REALLY nice feature I’ve always wanted – the ability to just take the last command typed at the console and put it into the edit tab.
Here’s a before and after look (without, then with ISE Steroids installed and running)
versus
The community feed at the bottom is a very nice touch, although all the new tools was surprising (in a nice way). After using it a bit, on a system without ISESteroids, the ISE felt somewhat more primitive (not unlike using PowerShell V2’s ISE today!).
All those extra tools and a lot of the features in ISESteroids are focused on helping you to write better PowerShell code and streamlining that process as much as you can. In short: good practice built in, and more, more, more automation of the code development process.
Once I started writing scripts with ISESteroids enabled I saw some changes in the ISE’s Edit pane. Some language elements were marked with a ‘squiggle’ underneath. And the edit pane itself has been reformatted with some new elements. Here’s an example of a very simple script
Just above the number 1 and 2 are two things ISESteroids ‘complains’ about. The first thing is that I used an alias (LS) instead of the full cmdlet name (Get-ChildItem); the second thing is that I am using a string but it is delimited with a double quote, not a single quote. Single quotes, unless you are including variable expansion, are less performant. The third cool thing shown here is that ISESteroids keeps track of functions and shows you how often they are referenced. You can see here the FOO function was referenced just once just once. The final thing to notice is the new search bar – just type a function name, and PowerShell, jumps to that function definition in the code. Great for when you need to update a function definition you call a dozen times in your script!
ISESteroids also makes it easy to get rid of those squiggles. To fix the two issues above, you just hover over the bottom bar in the ISE windows and ISESteroids pops up messages like:
This makes it really simple to fix issues like this. I would have liked to have been able to just right click over the squiggle and select the fix from there – but the bottom of the window works too.
As you delve into using the ISE, just about every menu and tool bar is expanded. To name a few:
- The File Menu now has an sub menu to open your profile files (you can open both console and ISE profiles).
- The file Menu also has a Print menu item.
- The Tools Menu now has a couple of new tools and options.
- The Add-ons menu has new menu items for moving tool panes around the ISE UI. Useful if you are using some of the tools!
This is just scratching the surface. I’ve got a bit of a coding project coming up and so will be using ISESteroids more heavily and will gladly provide more feedback.
For more information about the product, see the documentation: http://www.powertheshell.com/isesteroids2/documentation/.
One final thing – ISESteroids is not a free product. Single use is €99 although there are volume discounts. BUT because the author is such a fan of the community, he has created what they call their ‘Helping Hands Programme’ – in effect they offer free NFR (not for resale) personal ISESteroids 2.0 Enterprise license in exchange for 3-5 hours of your work, helping them to make ISESteroids better known, and better documented. A very generous offer!
In summary, ISESteroids is a tool that adds value to the PowerShell ISE and helps you to write better scripts. If you are writing scripts and other PowerShell related artifacts as a key part of your job then this product is certainly worth the money.
Monday, November 03, 2014
Enums in PowerShell V5
As I noted in an earlier blog post, we have begun to see the contents of what eventually is to become PowerShell V5. Amongst the cool features that are to be delivered in V5, one of my favourite is the ability to define Classes and Enums in PowerShell. I'll leave Classes for another day (and possibly multiple blog posts), but let's look at Enums.
First, what is an enum? An enum is a type that create a list of named constants. In the .NET Framework, you find the System.Enum class – which implements enums.
You can think of an enum as all the proper values that some parameter can take. For example, if you were implementing a pizza application, you might have an enum called PizzaSize, representing the available sizes of pizza and another enum called PizzaToppings that contains the valid names of all the toppings you can put on your pizza.
Of course, you could have always used the ENUM feature of .NET, and there are a lot of enums already defined. For example, System.Net.Mail.MailPriority is an existing enum in the .NET Framework 4.5, which specifies the valid values for mail priority. This is a simple enum, with just three values: High, Low and Normal. If your code/script/function is passed a value for mail priority, it's always a good idea to validate it – and here's some PowerShell Code that can do this:
# Enums.ps1
Function Confirm-MailPriority {
param ([string] $mailpriority)
if ([enum]::IsDefined(([System.Net.Mail.MailPriority]),$mailpriority))
{Return $true}
Else
{return $false}
}
This function takes a string representing mail priority and returns true or false depending on whether it's valid. Here is the results of testing this function:
Now as you can see – the validation is case sensitive – thus 'High' is a valid mail priority, whereas 'high' isn't. You can get around that by fully spelling out the enum, and letting .NET work out the validity. Thus 'high' is invalid whereas [System.Net.Mail.MailPriority]::high (and [System.Net.Mail.MailPriority]::High) are both valid. This matters a lot if you are calling .Net method and passing enumerable values (e.g. mail priority).
Up until Version 5 of PowerShell, you could always use the [enum] class to validate and list all the valid values of existing Enums. But what you did not have, up till now, is the ability to create a real Enum in PowerShell. Of course, you could have used Add-Type, and specified the C# code but I don't regard that as quite the same thing as defining an enum in PowerShell directly.
In V5, it's trivial to create an enum. Just specify it's name, follow it by a script block with each enumerable value on a separate line. Like this:
Enum PizzaSize {
Small
Medium
Regular
Large
ExtraLarge
}
Note there are no commas separating the values,just a newline. I wonder if this is a limitation of the current release and maybe additional delimiters will come in later versions. We'll have to see!
Once you define this enum, you can then use the enum and can validate it:
$size = [pizzasize]::large
[enum]::IsDefined(([pizzasize]),$size)) # True!
This is pretty cool – and lays at least part of the foundation for you to be able to develop full .NET Classes in PowerShell.
There is at least one limitation I am aware of with Enums in PowerShell and that is that they are not persistent. Unlike the .NET Framework enums which are always available (one the relevant .NET Class Library is loaded!), you need to define enums in each script that uses them. That is, thinking about it, not such a great limitation – you just need to define your enums where you use them.
My preferred place is as as part of a module definition – just put your enums for your module in a file such as Enums.ps1 and put it into the module folder. Then, in the ScriptsToProcess key of the module's manifest, just specify Enums.ps1. That will dot-source them into your global environment and are then available for all the code you then run.
Enums are one important part of being able to develop a class in PowerShell. I'll be developing another article to describe how that works. I will probably wait till after the next drop of PowerShell V4, which is scheduled for November some time.
Sunday, November 02, 2014
PowerShell OneGet Monthly Call
I am not quite sure how this got out here, but am glad it did. This (https://t.co/mkafiMJR9T) is a web cast covering the current state of play with the OneGet feature of PowerShell V5.
This is awesome stuff – keep it up!
Spam and IM
In a number of documents relating to OCS and Lync, I've seen discussion of Spam over IM (SPIM). I've not really seen much decent discussion of it, other than it's an issue. Most of the material seems to assume you know all about SPIM.
For those that are not familiar, you might want to look at RFC 5039. This document provides some great background in SPIM and other malevolent IM related stuff.
Wednesday, October 22, 2014
Managing Zip Files with PowerShell V5
In a recent blog post, I noted the arrival of PowerShell V5 preview within the technical preview of Windows 10. A slightly later version than is available for installation on down-level operating systems ( I use the latest V5 preview version both on my Windows 8.1 laptop and my main home workstation (which runs Server 2012 R2). While Desired State Configuration is the ‘big’ new feature in V5, there are a lot of other cool features in V5, including the ability to manage zip files with PowerShell.
The later V5 preview versions come with two new cmdlets or managing ZIP files:
- Compress-Archive
- Expand-Archive
The Compress-Archive cmdlet takes an array of file names (specified via the –Path parameter) and compresses them into an archive file (specified by the -DestinationPath Parameter). You can also specify the level of compression – the valid values are NoCompression, Optimal, Fastest. Fastest means that the compression is less than Optimal, but Optimal should produce slightly smaller .ZIP files. Optimal, however, takes more CPU time – but there’s not much difference for smaller files. To have Compress-Archive update some or all the files in the archive, use the –Update parameter. This parameter updates the archive with the specified files. Thus you can update a single file in an archive should the need arise.
The Expand-Archive cmdlet expands the files in the archive (specified by the –Path parameter) into the folder specified by the –DestinationPath parameter. To avoid being asked for permission to do the expansion, you can speciy the –Force parameter.
Here’s an example of some archive file manipulation
PSH [C:\foo]: ls c:\foo\*.txt
Directory: C:\foo
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 26/07/2014 15:59 431 atia.txt
-a---- 19/06/2014 17:25 18890 history.txt
-a---- 06/03/2014 15:09 1027 hosts.txt
-a---- 06/08/2014 10:05 37 NAMES.TXT
-a---- 24/09/2014 06:58 1877 trans1.txtPSH [C:\foo]: (ls *.txt | measure -sum -Property length).sum
22262PSH [C:\foo]: Compress-Archive *.txt -DestinationPath .\aaa1.zip -CompressionLevel Fastest
PSH [C:\foo]: Compress-Archive *.txt -DestinationPath .\aaa2.zip -CompressionLevel Optimal
PSH [C:\foo]: Compress-Archive *.txt -DestinationPath .\aaa3.zip -CompressionLevel NoCompression
PSH [C:\foo]: ls c:\foo\aaa?.zip
Directory: C:\foo
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 21/10/2014 18:33 2172 aaa1.zip
-a---- 21/10/2014 18:33 2039 aaa2.zip
-a---- 21/10/2014 18:33 22783 aaa3.zipPSH [C:\foo]: Expand-Archive c:\foo\aaa1.zip -DestinationPath c:\foo\expanded -Force
PSH [C:\foo]: dir .\expanded
Directory: C:\foo\expanded
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 21/10/2014 18:34 431 atia.txt
-a---- 21/10/2014 18:34 18890 history.txt
-a---- 21/10/2014 18:34 1027 hosts.txt
-a---- 21/10/2014 18:34 37 NAMES.TXT
-a---- 21/10/2014 18:34 1877 trans1.txt
In summary, two new and somewhat overdue cmdlets that make your life easier!
Monday, October 20, 2014
Another PowerCamp is Over
Last weekend, I held another PowerShell PowerCamp event – we had 19 attendees in all for two days of PowerShell. It was a great weekend, topped off by Tom Arbuthnot coming in on the Sunday to deliver a guest lecture. I really enjoyed it, but it was a lot of work! And from the mail I've had, the attendees got a lot out of it.
Thanks to the folks at Microsoft, particularly Claire Smyth, for all their help in making the weekend a success.
During the event, there were several ideas put forward to a next event. One suggestion was a more advanced weekend, particularly looking at DSC and the new things in Version 5. A V5 PowerCamp could be fun! Ideas as to future events are most welcome.
PowerShell Version 5 in Windows 10 Preview
Like a lot of people, I’ve downloaded and been playing with the previews of Windows 10 (client and server). About the first thing I did was to check out PowerShell and was delighted to find it contains a very late drop of the PowerShell V5 code – marginally later than the WMF Preview shipped in September.
My Server 2012R2 workstation, which has the September V5 drop reports:
Meanwhile, in the Windows 10 Server preview, we see:
As you can see, Windows 10 has a slightly newer version of PowerShell V5. The release notes don’t clarify what has changed, but I’d have expected the 9841 to be just a bug fixed fork of 9814.
This new version of PowerShell brings some big changes, not least of which is the improvements and enhancements to Desired State Configuration – no doubt this will feature large in the eventual launch of Windows 10 Server (Server 2015??).
But there are also a bunch of smaller changes that I also am very keen to see go mainstream. These include:
- Archive (.ZIP file) cmdlets
- Changes to –item noun to enable symbolic links
- The ability to develop classes (and enums) using PowerShell
- Improvements in DSC authoring within the ISE
- PowerShell transcripts within the ISE
- Better script tracing
PowerShell V5 looks like being a block buster! I’ll be writing blog articles about each of these new features along with some usage of them for your delight!
Tuesday, September 30, 2014
PowerCamp Power Guest–Tom Arbuthnot
As part of the event, I always try to get another guest speaker, who I ask to talk about PowerShell in general. What are the things they have learned (which attendees will have to to)? What are their best practices? For this event, I am pleased to announce we will have the presence of Tom Arbuthnot, a superstar Lync MVP and Lync Consultant (and a Lync MCM!), and a great PowerShell evangelist. Tom’s spoken before at these events, and his talks are good and very entertaining.
I still have a few places left on this event – so if you want a great jump start to PowerShell, or to review the basics and more, then contact me at DoctorDNS@Gmail.Com !
Thursday, September 18, 2014
Azure for Longer Term Backup
I’ve been teaching the AOTG (Ahead of the Game) partner training around the UK, and shortly in Eire. It’s been very interesting talking to Microsoft’s SMB partners and looking at how they sell and utilise Azure. One of the Azure Products this training is advocating is Azure Backup. Last week, when I was teaching this in Manchester, one delegate pointed out that the big downside to Azure backup was that there was not much of a retention period and as such was not helpful to the delegate’s customers.
Fast forward a few days, and the wish has come true. I had a conference call this morning with the Azure backup who told me that this request had been heard loud and clear and is now in place. He pointed me to the blog post at: http://azure.microsoft.com/blog/2014/09/11/announcing-long-term-retention-for-azure-backup/
Sure enough, you can get all the backup you need (well all reasonable backups!). And the maximum retention period is 9 years, as the blog post explains.
One word: Awesome!
Saturday, August 30, 2014
Documentation–documenting variables in a script/function
A few weeks ago, I gave a PowerShell course during which the issue of documentation came up. The point I made was documentation is a good thing – and the more the better. The delegates really liked the comment based help approach. But it often does not go quite far enough.
One additional thing you can do is to document individual variables. Each variable object lives in the Variable: drive. Variables are , like everything PowerShell, an object. When you get child items of a variable, the variable is returned of the type System.Management.Automation.PSVariable. There are some special PowerShell variables (QuestionMarkVariable, LocalVariable, SessionStateCapacityVariable, and NullVariable). All of these objects have a Description property which enables you to describe each variable.
So you could do this:
$I = ‘10.0.0.100’
(dir variable:I).description = ‘the new IP address for the new server’
$iold = ‘10.0.1.200’
(dir variable:iold).description = ‘the new IP address for the new server’
Dir Variable: | Format-Table name,description –a
I’ve not used this approach much, but I probably do so in the future for production scripts at least!
Friday, August 29, 2014
Azure Machine Learning – What is it and Doing it In Azure
Azure Machine Learning is another of those features of Azure I've not gotten around to playing with. Andrew Fryer of Microsoft has produced a couple of good articles on the subject, both in general and Azure specific.
Machine Learning appears to be the new marketing buzzword previously known as data mining. Given enough data, you can mine it to find gold is the basic concept. In his first article, Fryer looks at what Machine Learning (ML) is and some of the basic tasks. In the second article, Fryer looks at exploring and evaluation of the technique to see if it's of value to an organisation.
Desired State Configuration Resource Kit–Wave 6
The PowerShell team has just released an update to the DSC resource kit – bringing the total number of DSC resources to over 80! While the bulk of the resources in the resource kit are ‘experimental’ – they seem to me to be very stable (continuing the PowerShell team’s ability to ship rich, useful, and reliable beta code).
And even better, the PowerShell team seem to have gone back to their old roots in terms of time to market. They appear to be releasing as they develop (and long may this continue). Thus, the new SafeHarbor DSC resource, this was finished after Wave 5 was released but before Wave 6 was ready so the PowerShell team published it separately, then publish it (with updates and bug fixes) a few weeks later in the Wave 6 drop. I can’t tell you how good this feels after so long under the cone of silence.
This latest drop has some very interesting resources, including the xChrome and xFirefox resources that help to deploy these two browsers. The Group resource shipped with PowerShell 4 is updated to provide support for cross-domain account lookups as well as for UPN-formatted names. The new xRemoteDesktopAdmin resource enables. Additionally, Wave 6 has a number of bug fixes to earlier waves. Again – the ability to get these fixes quickly is both useful and much appreciated.
The DSC story is slowly coming clearer with both the July drop and these continuingly improving resources. And with Chef integrating with DSC, DSC’s future looks very rosy. If you are looking to find out a bit more about DSC – I’ll be covering the basics on the PowerShell PowerCamp event in October.
Synchtoy–a free utility from Microsoft
I just stumbled across an interesting utility, called SyncToy. Version 2.1 of this tool is available, free, from Microsoft at: http://www.microsoft.com/en-us/download/details.aspx?id=15155. This is the latest version of this tool, which was first published in 2009, so it’s not really new.
This highly customisable tool synchronises files and folders between file locations, kind of like a robocopy designed just to synch your files between two locations. You could use this to sync files such as photos, music files etc. with other computers. This might be easier than worrying about backup for these files.
To find out more about Synchtoy, or to ask questions – see the synch toy forum at: http://social.microsoft.com/Forums/en-US/home?forum=synctoy.
Tuesday, August 26, 2014
PowerShell V5 July 2014 Preview
As promised by Jeffrey Snover at TechEd US, Microsoft has released a new and updated pre-release version of PowerShell V5. Oddly, I can’t find too many references to it, but here is where you can get the preview:
- X64 - http://download.microsoft.com/download/E/D/B/EDB86AD9-4D26-4C33-A8B2-82BE161682E2/WindowsBlue-KB2969050-x64.msu
- X86 - http://download.microsoft.com/download/E/D/B/EDB86AD9-4D26-4C33-A8B2-82BE161682E2/WindowsBlue-KB2969050-x86.msu
Note that these versions only install on Windows 8.1 and Server 2012 R2. My main workstation runs Windows Server 2008 R2 and while I know it needs upgrading, I am dreading the upgrade. For now, I’m running this update on just my laptop. Sadly – as this update has a lot of new features.
The new features, described in more detail in the release notes, include:
- Generation of Cmdlets based on an Odata Endpoint - Export-ODataEndpointProxy is a cmdlet that will generate a set of Windows PowerShell cmdlets based on the functionality exposed by a given OData Endpoint. This feature is still not quote complete as it’s still under development – but this looks a great idea to open up OData to wider use.
- Manage .ZIP files with new cmdlets – finally two new cmdlets to manage zip files: Compress-Archive creates a new zip file while Expand-Archive allows un-zipping. At long last!
- DSC authoring improvements in Windows PowerShell ISE. Several new features are added to the ISE to simplify authoring of DSC resources, including the ability to list all the DSC resources within a configuration block (use Ctrl+Space) and lots of improvements to autocomplete/tab complete.
- Changes in how the DSC Local Configuration Manager is installed.
- Partial DSC configurations – this, for me, was a missing piece to DSC. Partial DSC Configuration enables you to deliver configuration documents to a node in fragments. This is, for me, a great simplification in how you deploy DSC configurations.
- Cross-Computer Synchronisation – this improves the built in WaitFor DSC resources. This is highly important for complex multi-node configuration scenarios where you need to sync several systems in order to properly configure them.
- New DSC cmdlets – there are several new cmdlets, including Get-DSCConfigurationStatus, Compare-DNSConfiguration, Publish-DSCConfiguration and Update-DSCConfiguration.
- The new Detailed Script Tracing feature enables detailed tracking and analysis of Windows PowerShell scripting use on a system. After you enable detailed script tracing, Windows PowerShell logs all script blocks to the ETW event log, Microsoft-Windows-PowerShell/Operational. If a script block creates another script block (for example, a script that calls the Invoke-Expression cmdlet on a string), that resulting script block is logged as well. I can see this being very, very useful!
- The *-item cmdlets are extended to enable creation of symbolic links. Yet another cmd.exe feature now with PowerShell parity. YEAH!
- And of course the latest WMF includes the cool features added to earlier versions, including OneGet, PowerShell Get, Network Switch management
PowerShell V5 is shaping up to be a pretty significant release, with a slew of really cool and, IMHO, important new features. I just hope there will be a version of PowerShell V5 for Windows 7/Server 2008 R2 so I can avoid the OS upgrade on my primary workstation.
Once I have this new update installed on my laptop, I’ll provide some additional feedback. I am looking forward already not only to playing with this new release, but in seeing what else Redmond and the PowerShell team have up their sleeves.
Tuesday, August 12, 2014
Azure PowerShell DSC Extension
The PowerShell team have just published a new DSC extension to cater for Azure. You can find more information from the PowerShell team's blog post. he blog post shows yow you can use this extension. Before you use these cmdlets, you will need to have the Azure PowerShell SDK (0.8.6 or later) installed. See here to download the SDK.