header image

Archive for May, 2011

Is there a time when you shouldn’t use PowerShell – No Is there a time when there might be better alternatives – Yes I can think of a number of situations where writing a PowerShell script may not be the most effective answer: a simple one off or very infrequent task that can be done […]

under: PowerShell Basics

  The utility cmdlets are the glue that we use to bind our actions together on the PowerShell pipeline. We can easily discover the list of utility cmdlets by using Get-Command *-object I split the utility cmdlets into two groups.  The first group I use all of the time ForEach-Object Select-Object Sort-Object Where-Object The second […]

under: PowerShell Basics

Just discovered a typo in the advanced function template I posted. http://msmvps.com/blogs/richardsiddaway/archive/2011/05/24/advanced-function-template.aspx It should be function aaaa-yyyyyy{ [CmdletBinding(SupportsShouldProcess=$true,     ConfirmImpact="Medium Low High None",     DefaultParameterSetName="XXXXX")] param ( [parameter(Position=0,    Mandatory=$true,    ParameterSetName="YYYYYYYYYY",    ValueFromPipeline=$true,    ValueFromPipelineByPropertyName=$true,    ValueFromRemainingArguments=$true,    HelpMessage="Put your message here" )]    [Alias("CN", "ComputerName")]     [AllowNull()]    [AllowEmptyString()]    [AllowEmptyCollection()]    [ValidateCount(1,10)] […]

under: PowerShellV2

Don’t forget to add the June meeting of the UK PowerShell User group to your calendar.  Its June 21 at 7.30pm BST. Details available from http://msmvps.com/blogs/richardsiddaway/archive/2011/05/10/powershell-uk-user-group-june-meeting.aspx

under: PowerShell User Group

Hardware Update

Posted by: | May 30, 2011 | No Comment |

Last year I bought a Lenovo W510 to use as my mobile(ish) Hyper-V lab.  I mentioned the initial problems I’d had with core parking – http://msmvps.com/blogs/richardsiddaway/archive/2010/08/06/lenovo-w510-hyper-v-and-bsod.aspx Once those were resolved I haven’t had any other problems with it.  I never did get Virtual Machine Manager installed – I tripped over a problem that VMM won’t […]

under: Technology

Discussions at the PowerShell Deep Dive and the entries for the Scripting Games showed me that there is tremendous amount of interest in PowerShell but that there are a lot of people that are still unsure of how to get started on want to take PowerShell a bit further than stringing cmdlets together on the […]

under: PowerShell Basics

Today, for one day only, get 50% off PowerShell and WMI MEAP or MEAP+ebook.   The code is dotd0529cc when you order from www.manning.com   The same code can be used for PowerShell in Action – second edition and PowerShell in Practice

under: Books, PowerShell and WMI, PowerShellV2

A number of the classes in root\wmi return results from more than one class. That sounds odd but it can be explained by an example. The namespace contains a number of classes related to the battery in laptops gwmi -Namespace root\wmi -List *battery* MSBatteryClassEvent BatteryStatusChange BatteryTagChange MSBatteryClass BatteryStaticData BatteryRuntime BatteryCycleCount BatteryTemperature BatteryStatus BatteryFullChargedCapacity   We’ll […]

under: PowerShell and WMI

Testing the individual classes in root\wmi is a pain – so its time for some brute force.  I’ll select a group of classes and test the selection gwmi -Namespace root\wmi -List system* | fw   I can then iterate through them calling get-wmiobject. This is a command line activity so aliases are OK gwmi -Namespace […]

under: PowerShell and WMI

Continuing our exploration of the murky jungle that is the root\wmi namespace we find a number of classes related to system configuration gwmi -Namespace root\wmi -List *system* | fw   Of theses the only one I could get a respnse from on Windows 7 or Windows 2008 R2 was MS_SystemInfo. gwmi -Namespace root\wmi -Class MS_SystemInformation […]

under: PowerShell and WMI

Older Posts »