Monthly Archives: July 2013

AD Management MEAP

A new MEAP was released last week for AD Management in a Month of Lunches.  Chapters 1-15 are now available http://www.manning.com/siddaway3/

Posted in Active Directory, Books, PowerShell V3, Windows Server 2012 | Leave a comment

Case sensitive operators

PowerShell is more or less case insensitive so the operation in my previous post $_.Substring(3,1) -ne “T” will trigger on “T” or “t” If you only want the uppercase version to fail then you can use the case sensitive version … Continue reading

Posted in Powershell Basics | Leave a comment

Validating parameters

PowerShell provides a number of ways of validating the values input to the parameters in your scripts. One such way is Validate script. I came across an interesting question where the inquirer wanted to test an input parameter and throw … Continue reading

Posted in Powershell Basics, PowerShell V3 | Leave a comment

Measure-Object

One cmdlet that I don’t think gets used enough is Measure-Object. This enables you to find the minimum, maximum, sum and average of a set of numbers coming down the pipeline PS> 1..12 | Measure-Object -Sum -Maximum -Minimum -Average Count    … Continue reading

Posted in Powershell Basics | Leave a comment

Deleting a file with WMI

Following on from the last post this is how you can delete a file. Use the same file structure as previously This time you need to use the CIM_DataFile class. It’s one of the few classes I’ve found that doesn’t … Continue reading

Posted in File system, PowerShell and WMI, PowerShell V3 | Leave a comment

Deleting Folders with WMI

I recently saw a question about deleting folders with WMI. Let’s create a file structure we’re happy to delete New-Item -Path c:\ -Name Expendable -ItemType DirectoryNew-Item -Path c:\Expendable -Name Target1  -ItemType DirectoryNew-Item -Path c:\Expendable -Name Target2  -ItemType Directory Get-Process | … Continue reading

Posted in File system, PowerShell and WMI, PowerShell V3 | Leave a comment

Excel–named range

To create a named range in an Excel spreadsheet $xl = New-Object -ComObject ‘Excel.Application’$wkbk = $xl.Workbooks.Add()$sheet = $wkbk.WorkSheets.Item(1)$range = $xl.Range(“A1”, “D4”)$range.Name = “Test” Just to show how to work with named ranges $range2 = $xl.Range(“Test”)$range2.Borders.Color=0$range2.Borders.ColorIndex=26$range2.Borders.Weight=2$xl.visible = $true

Posted in Office 2013, PowerShell V3 | Leave a comment

PowerShell help RSS feed

The updatable help in PowerShell 3.0 caused a lot of confusion when that version first shipped. The help files have been updated periodically since 3.o shipped but its always been difficult finding out when they’ve been updated. That’s changed There … Continue reading

Posted in PowerShell V3, PowerShell v4 | 2 Comments

Office365 ate me RSS feeds

Just been puzzling out why I haven’t been getting any RSS feeds for a few days.  Looks like when I hooked up my Office365 account to Outlook it took out all the RSS feeds.  Fun time to come putting them … Continue reading

Posted in Office 2013 | Leave a comment

New-mailbox oddity

I’ve been doing a lot with Exchange recently and found an interesting quirk. If you use the New-mailbox cmdlet with the –PrimarySMTPaddress parameter the mailbox doesn’t get email address policies applied. You need to use set-mailbox to turn policy application … Continue reading

Posted in Exchange, Powershell | 1 Comment