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 […]
Archive for June, 2011
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) } […]
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 […]
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 […]
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 […]
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 […]
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 […]
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 […]
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
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 […]
Categories
- .NET
- Active Directory
- Architecture
- Azure
- Bash
- BITS
- Books
- CDXML
- CIM
- Cloud
- COM
- Containers
- Deep Dive
- Desired State Configuration
- DevOps
- DHCP
- DNS
- DSC
- European Summit
- Events
- Exchange
- File System
- Firewall
- General
- General IT Matters
- Hyper-V
- IIS
- Infrastructure
- IT Community
- IT Security
- Learning PowerShell
- Linux
- Math
- Microsoft
- Modules
- Nano Server
- Networking
- Office 2010
- Office 2013
- Open Source
- Opinion
- Outlook
- Philosophy
- PowerShell
- PowerShell 7
- PowerShell and .NET
- PowerShell and Active Directory
- PowerShell and CIM
- PowerShell and Exchange 2007
- PowerShell and IIS
- PowerShell and SQL Server
- PowerShell and WMI
- PowerShell Basics
- PowerShell original
- PowerShell Summit
- PowerShell User Group
- PowerShell User Group 2
- PowerShell v2
- PowerShell V3
- PowerShell v4
- PowerShell v5
- PowerShell v6
- PowerShell.org
- PowerShellGet
- PowerShellV2
- PSAM
- Rant
- Registry
- Scripting
- Scripting Games
- Scripting Games 2104
- Security
- SQL Server
- Storage
- Strings
- Summit
- Technology
- Uncategorized
- Virtualization
- Windows 10
- Windows 2012 R2
- Windows 7
- Windows 8
- Windows 8 Server
- Windows 8.1
- Windows Server
- Windows server 1709
- Windows Server 2008
- Windows Server 2008 R2
- Windows Server 2012
- Windows Server 2012 R2
- Windows Server 2016
- Windows Server 2019
- WMFv5
- WPF
- WSUS