Monthly Archives: August 2009

PowerShell v2 help file

In PowerShell v2 we get a nice graphical help system that includes the cmdlets, the about files and and the User and Getting Started Guide. It doesn’t include the help for the optional modules though which is a pity. The … Continue reading

Posted in PowerShell V2 | Leave a comment

Word Add a table

There seems to be two types of paragraph I create in Word documents – text or tables.  Lets start by adding a table. 001002003004005006007008009 function Add-Table {    param (        [int] $row = 2,        [int] $col = 5    )    $global:paragraph = $doc.Content.Paragraphs.Add()    $range = $paragraph.Range    $global:table = $doc.Tables.Add($range,$row,$col)}   The function Add-Table takes two integers as … Continue reading

Posted in PowerShell V2 | Leave a comment

Enable Ping

I’ve got a few talks coming up so need to build some more demo machines.  One thing I like to be able to do in the demo environment is ping between machines – sometimes necessary when testing things out but … Continue reading

Posted in Powershell | Leave a comment

Module path

PowerShell v2 has 2 default locations for modules – in the install directory and in your profile.  My demo laptop is set to dual boot Windows 7 & Windows 2008 R2.  It would make sense to only maintain one set … Continue reading

Posted in PowerShell V2 | Leave a comment

Word New Document change

I started experimenting with the New-WordDocument function and realised I needed to change it to make the variables usable across the functions. 001002003004005 function New-WordDocument {    $global:word = New-Object -ComObject Word.Application    $word.Visible = $true    $global:doc = $Word.Documents.Add() }   Simple change is to make the variables global in scope.  This means … Continue reading

Posted in PowerShell V2 | Leave a comment

Word New Document

Lets add another function to our module for working with Word.  Its time to create a new word document 001002003004005 function New-WordDocument {    $word = New-Object -ComObject Word.Application    $word.Visible = $true    $Word.Documents.Add() | Out-Null}   Create the object for word as before.  Set the visible property to true (we can’t … Continue reading

Posted in PowerShell V2 | Leave a comment

Word Autocorrect

If you have been following this blog for awhile you will know that I build and rebuild machines on a reasonably frequent basis.  One drawback to this that I have to keep re-creating the Autocorrect entries.  I do a lot … Continue reading

Posted in PowerShell V2 | Leave a comment