PowerShell for Windows Admins:

July, 2013


July 15, 2013  12:32 PM

AD Management MEAP

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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/

July 8, 2013  3:31 PM

Case sensitive operators

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 of –ne which is –cne. This changes the script...


July 8, 2013  1:39 PM

Validating parameters

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 an error if the 4th character was a “T” One solution...


July 7, 2013  2:52 PM

Measure-Object

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 : 12 Average : 6.5 Sum : 78...


July 7, 2013  1:01 PM

Deleting a file with WMI

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 have a Win32_ equivalent. The class has a Delete method. Assuming you...


July 7, 2013  12:41 PM

Deleting Folders with WMI

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 Directory New-Item -Path c:\Expendable -Name Target1 -ItemType Directory New-Item -Path c:\Expendable -Name Target2 -ItemType...


July 5, 2013  12:56 PM

Excel–named range

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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")...


July 4, 2013  12:14 PM

PowerShell help RSS feed

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 is now an RSS feed that provides...


July 3, 2013  2:12 PM

Office365 ate my RSS feeds

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 back


July 2, 2013  12:58 PM

New-mailbox oddity

Richard Siddaway Richard Siddaway Profile: Richard Siddaway

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 on – after the mailbox...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: