powershell

vCheck - Now Available on GitHub

The unbelievably successful vCheck script from Alan Renouf which can be used to provide a daily report on your vSphere (and other technologies) environment is now available on GitHub. This is a great move since it more easily enables further community input to develop this tool further by allowing you to submit contributions via a central repository. If you’ve not used GitHub before then head over to the home page and create an account.

Learning Points From PowerShell Scripting Games Event #4

Event 4 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Random AD Users The first part of this event is to work with 20 randomly selected users from Active Directory. Initial thoughts might be that this is pretty straightforward. If you use the Get-ADUser cmdlet from the AD module then you could do something like this:

Learning Points From PowerShell Scripting Games Event #3

Event 3 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Filter to the left Some cmdlets in PowerShell have their own filtering capabilities, which can make queries of large data sets more efficient. However, not all cmdlets do have this capability and you will need to pipe the results to Where-Object instead. It’s always worth checking the help and examples for a cmdlet first to see the best way to filter and if it has an option to do so then use it!

Learning Points From PowerShell Scripting Games Event #2

Event 2 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Win32_Processor This event is a bit of a sneaky one and if you haven’t been affected by the issue before then you may not know it. The particular issue I am referring to here is that “The number of physical hyperthreading-enabled processors or the number of physical multicore processors is incorrectly reported in Windows Server 2003”.

Learning Points From PowerShell Scripting Games Event #1

Event 1 for the PowerShell Scripting Games 2013 has closed, here are a few learning points I picked up on from entries submitted. 1) Get-ChildItem -Recurse When you need to retrieve files from paths with subfolders the Recurse parameter of Get-ChildItem makes this really easy. For instance Get-ChildItem -Path C:\\Application\\Log -Filter \*.log -Recurse is a really easy way to return everything below C:\Application\Log. In the specific instance of this event, this is OK because you only have three subfolders, but potentially there could be a lot more and some of them might not be relevant.

PowerShell Scripting Games 2013

Looking for a good way to start learning PowerShell or fancy testing yourself with some more advanced problems to solve? It’s time again for the annual Scripting Games and this year the PowerShell community are running the event, ably supported by the Microsoft Scripting Guy. There are separate Beginner and Advanced tracks and plenty of prizes to be won in each event. I’ll be helping out with the other community judges to highlight some of the entries.

Downloading Single or Entire Ranges of Lego Set Instructions with PowerShell

Update 20/07/2015: The details in this post are now superseded by a post I have made using the Brickset API. -——————————————————————————————————————— I’ve always enjoyed Lego and it’s currently experiencing a resurgence in our house thanks to strategic hinting encouragement that my children would find it fun too. (It seems like I’m not the only one) What does tend to happen though is that as sets are pulled apart played with we often need to dig out the instructions to put entire sets pieces back together again.

Start-BitsTransfer - Submitting greater than 60 asynchronous jobs generates error

Start-BitsTransfer enables you to download multiple files using Windows’ Background Intelligent Transfer Service , including the ability to have them processed as background jobs. I encountered an issue when submitting these jobs if the number of files where greater than 60, the 61st and onwards would fail to submit until the existing jobs had been completed or cleared. Start-BitsTransfer : Object reference not set to an instance of an object. At line:1 char:1 + Start-BitsTransfer -Source "http://intranet.

Issue with PowerCLI: Not authenticated and session timeout

A colleague of mine experienced this issue recently where after making a PowerCLI connection to a vCenter and instantly running a command such as Get-VM, he would be prompted by the error: Get-VM. Not authenticated. Possible cause of this error is that the connection was left unused for a while and session has timed out. Checking he was connected to a vCenter appeared to indicate that he was, i.e. $global:defaultVIServer returned a value.

Writing PowerShell Code on OS X using Sublime

The majority of my PowerShell code is written in a Windows VM where all the typical native PowerShell tools are available. However, occasionally I may want to quickly view or make small changes to some code in OS X. It’s possible via the built-in TextEdit application, but that’s kind of the equivalent of using Notepad on Windows, i.e. a pretty basic experience. I recently read this review of Text Editors on The Register and decided to check out Sublime after discovering PowerShell could be added as an additional language to support syntax highlighting.