header image

Archive for June, 2011

A loop is used to repeat one or more commands a certain number of times or while a condition is true.  There are a number of ways of generating a loop in PowerShell. These examples show the basic structure of each loop type. 1..10 | foreach-object {$_} 1..10 | foreach {$_} $xs = 1..10 foreach […]

under: PowerShell Basics, PowerShellV2

Oddly the methods for changing the brightness aren’t on the WmiMonitorBrightness we get a separate class with the methods. This function can be used to set the brightness function set-monitorBrightness { [CmdletBinding()] param ( [ValidateRange(5,20)] [int]$timeout=5,   [ValidateRange(0,100)] [int]$brightness ) $monitors = Get-WmiObject -Namespace root\wmi -Class WmiMonitorBrightnessMethods foreach ($monitor in $monitors){   $monitor.WmiSetBrightness($timeout, $brightness)   }     […]

under: PowerShell and WMI, Technology

The monitor brightness can be discovered like this function get-monitorBrightness { $monitors = Get-WmiObject -Namespace root\wmi -Class WmiMonitorBrightness foreach ($monitor in $monitors){   $brightness = New-Object -TypeName PSObject -Property @{         CurrentLevel = $monitor.CurrentBrightness         MaxLevel = $($monitor.Level | sort | select -Last 1)      }   $brightness   }     }   The WmiMonitorBrightness class is […]

under: PowerShell and WMI, Technology

Advanced Format disks have started shipping –see http://managedux.com/2011/04/26/using-vbscript-to-check-partitions-for-advanced-format-4k-512e-sector-alignment/ These disks use a 4096 byte sector instead of 512. To get the best performance from these disks the partitions have to be aligned to a 4K boundary. This happens automatically in Windows 2008 and above.  We need to be able to start testing partition alignment. This […]

under: PowerShell and WMI, Technology

One sad casualty of my move to Windows 7 and Office 2010 is the OneNote PowerShell provider. http://bdewey.com/2007/07/18/onenote-powershell-provider/ It doesn’t work vey well in this scenario. It will read oneNote pages but it doesn’t want to create, modify pages or content. Shame but this is one piece of functionality I will have to drop If […]

under: Office 2010, PowerShellV2, Windows 7

OpenXML and PowerShell

Posted by: | June 22, 2011 | No Comment |

While preparing for this months UK user group talk on PowerShell and Office I decided I wanted to include a look at working with the OpenXML format for Office documents that was introduced in Office 2007. These are the .docx and .xlsx versions of Word and Excel respectively. When writing PowerShell in Practice (www.manning.com/siddaway) I […]

under: Office 2010, PowerShellV2

Rescheduled UG meeting

Posted by: | June 21, 2011 | No Comment |

Apologies for rescheduling with no notice but my broadband router failed tonight. When: Thursday, Jun 30, 2011 7:30 PM (BST)Where: Live Meeting *~*~*~*~*~*~*~*~*~* Re-scheduled – using PowerShell to automate Office including Word, Excel, OneNote, Visio and Access Notes Richard Siddaway has invited you to attend an online meeting using Live Meeting.Join the meeting.Audio InformationComputer AudioTo […]

under: Office 2010, PowerShell User Group, PowerShellV2

My apologies to anyone who tried to connect to the PowerShell UK UG Live Meeting tonight. My broadband router stopped working, permanently, today and I didn’t find out until I got home from work. By the time I’d tracked down the problem, installed and configured a new router it was well past the meeting finish […]

under: PowerShell User Group

The PowerShell UK UG meets tomorrow (Tuesday 21 June) at 7.30pm BST Topic: PowerShell and Office see http://msmvps.com/blogs/richardsiddaway/archive/2011/06/12/powershell-user-group-21-june-2011.aspx for Live Meeting details

under: Office 2010, PowerShell User Group, PowerShellV2

Snapins to modules

Posted by: | June 19, 2011 | No Comment |

In PowerShell v1 we had snapins to extend and add functionality. In PowerShell v2 modules were added. Modules give us more flexibility and control. I’ve had to re-install a couple of snapins recently as part of the preparation for the presentation to the user group. I’d not put them on to my laptop when I […]

under: Modules, Office 2010, PowerShellV2

« Newer Posts - Older Posts »

Categories