Submitted By: Kent Finkle

Removes the password when opening an Excel spreadsheet. You must know (and supply) the correct password for this script to work.

$comments = @'
Script name: Remove-Password.ps1
Created on: Tuesday, July 03, 2007
Author: Kent Finkle
Purpose: How can I use Windows Powershell to
Remove the Password When Opening an Excel Spreadsheet?
function Release-Ref ($ref) {
[System.__ComObject]$ref) -gt 0)
$xl = new-object -comobject excel.application
$xl.Visible = $True

$xl.DisplayAlerts = $False
$wb = $xl.Workbooks.Open("C:\Scripts\Test.xls",0,$False,1,"%reTG54w")
$wb.Password = ""

$a = $wb.SaveAs( "C:\Scripts\Test.xls")
$a = Release-Ref($wb)
$a = Release-Ref($xl)