Take Hold of your PC with PowerShell
top of page

Take Hold of your PC with PowerShell


PowerShell is a scripting language that allows users to automate actions with software installed on a computer with a Windows operating system. Windows 7 and later systems come with Windows PowerShell Integrated Scripting Environment - a PowerShell editor. It's possible to find many powershell scripts online that perform different basic takes in Internet Explorer, Excel, Word and other common Windows programs. Combing the scripts together can allow you to automate repetitive tasks, and create a virtual progam of your own devising. Below is a script I found online which will automatically convert Word documents to PDF files:

$wdFormatPDF = 17

$word = New-Object -ComObject word.application

$word.visible = $false

$folderpath = "c:\FooFolder\*"

$fileTypes = "*.docx","*doc"

Get-ChildItem -path $folderpath -include $fileTypes |

foreach-object `

{

$path = ($_.fullname).substring(0,($_.FullName).lastindexOf("."))

"Converting $path to pdf ..."

$doc = $word.documents.open($_.fullname)

$doc.saveas([ref] $path, [ref]$wdFormatPDF)

$doc.close()

}

$word.Quit()

To run this script follow these steps:

1. Begin with a folder of Word documents.

2. Click on the Windows icon at the far lower left of your screen and type, "PowerShell" in the search box. Then click on 'Windows PowerShell ISE'.

3. In the editor that opens paste the script into the lower section and press return.

4. The script will run and you will see an indication in the bottom bar that it has been completed.

5. In the folder new PDFs will have been generated.


Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page