Posts Tagged ‘VBScript’

Office 2007 Deployment Computer Startup Scripts

Friday, May 25th, 2007

Now that MS Office 2007 is doing the rounds, I suppose it’s time to lookat some of its shortcomings.

It has a few when it comes to deployment. The biggest nuisance being deployment.

You have four options:

  • Install it on a PC manually (not great)
  • Deploy through group policy with no customisations
  • Use a deployment system such as SMS
  • Use a computer startup script

You may as well just say “no” to the first one. Anything more than a handful of PCs and you have a tedious task.

Group Policy has always been my method of choice. Most of my clients have less than 100 PCs, so Group Policy deployment is ideal. But as pointed out in the list, you cannot customise the installation with any defaults.

SMS is out. It’s not worth explaining to clients why it’s a good idea to buy software that makes my life easier. Even though the effort and management might simplify things somewhat.

So we’re stuck with computer startup scripts. Another method I hate - but if you want to control Office Deployments, then this is the way to do it. Thankfully, Aaron Parker has posted some startup scripts to help with this using the MSP method.

If you are using a network with WSUS, then updates become a non-issue, and I think that the only time to need to redeploy is if you decide to change the application packages that you want. At which point, you could check that executables of the programs exist or record your own registry entries that you can check for.

It’s not a great method (I’ve managed to avoid having to use ANY computer startup scripts in 2000-based networks) - but there’s no reason why it shouldn’t work. Especially if you make sure to use the quiet options in the Setup /admin tool.

Office, eh?

Set Focus on Web Pages

Sunday, February 4th, 2007

I found a neat post for setting auto focus without interfering with a user’s input if the page hasn’t yet loaded over at Wait till I come.

It’s quite handy as it discusses the usability of such a feature.

Excel to PDF

Tuesday, January 16th, 2007

Following my Word to PDF convertor script, here is the Excel version.

Prerequisites
MS Excel 2007
Office 2007 Save As PDF Plugin

Same rules apply. Copy and paste the code into notepad and save onto the desktop as ExceltoPdf.vbs.

'Excel to PDF
'By John Reid
'(c) 2007 bloggingIT - http://ccgi.maxpower.plus.com/wp

'Feel free to use, modify, and redistribute - just leave the credits intact

'Quick Export to PDF
Const xlTypePDF = 0

if  Wscript.Arguments.Count > 0 Then

 'Fire up MS Excel 2007
 Set objFSO = CreateObject("Scripting.FileSystemObject")
 Set objExcel = CreateObject("Excel.Application")
 
 'Enumerate the passed in file names
 For i = 0 to wscript.arguments.count - 1
  Set objFile = objFSO.GetFile(WScript.Arguments(i))
  Set objDoc = objExcel.Workbooks.Open(WScript.Arguments(i),,TRUE)
  dirPath = objFSO.GetParentFolderName(objFile)
  fileBaseName = objFSO.GetBaseName(objFile)
  'Export to PDF using preferred settings
  pdf = objExcel.ActiveWorkbook.ExportAsFixedFormat (xlTypePDF,dirPath & "\" & fileBaseName & ".pdf")
  objExcel.ActiveWorkbook.Close(False)
 Next
 'Quit MS Excel
 objExcel.Quit
Else
 msgbox("You must select a file to convert")
End If

Once saved, just select and drag any Excel document onto the script, and a PDF will be created in the same directory.

Yey!

Drag and Drop Convert Word to PDF

Tuesday, January 16th, 2007

Sometimes I find that it’s useful to save my Word documents as PDFs.

After playing around with the Save As PDF plugin for Office, I decided that it would be cool if I could write a script to convert a job lot of Word documents.

Prerequisites
MS Word 2007
Save As PDF Office 2007 Plugin

Just copy and paste the code into Notepad and save the file as WordToPDF.vbs on your desktop.

'Word to PDF
'By John Reid
'(c) 2007 bloggingIT - http://www.maxpower.plus.com
'Feel free to use, modify, and redistribute - just leave the credits intact
'Quick Export to PDF
Const wdExportAllDocument = 0
Const wdExportOptimizeForPrint = 0
Const wdExportDocumentContent = 0
Const wdExportFormatPDF = 17
Const wdExportCreateHeadingBookmarks = 1

if  Wscript.Arguments.Count > 0 Then
  'Fire up MS Word 2007
  Set objFSO = CreateObject("Scripting.FileSystemObject")
  Set objWord = CreateObject("Word.Application")

  'Enumerate the passed in file names
  For i = 0 to wscript.arguments.count - 1
  Set objFile = objFSO.GetFile(WScript.Arguments(i))
  Set objDoc = objWord.Documents.Open(WScript.Arguments(i),,TRUE)
  dirPath = objFSO.GetParentFolderName(objFile)
  fileBaseName = objFSO.GetBaseName(objFile)
  'Export to PDF using preferred settings
  pdf = objWord.ActiveDocument.ExportAsFixedFormat _
    (dirPath & "\" & fileBaseName & ".pdf", _
    wdExportFormatPDF, False, wdExportOptimizeForPrint, _
   wdExportAllDocument,,, _
   wdExportDocumentContent, _
   False, True, _
   wdExportCreateHeadingBookmarks)
 Next
 'Quit MS Word
 objWord.Quit(False)
Else
 msgbox("You must select a file to convert")
End If

When you find a document that you wish to convert, just drag and drop the file onto the script.

Right, there’s an Excel version along shortly.

The Joys of HTA

Friday, September 16th, 2005

I’ve been developing a number of HTA tools lately.

Certainly a pretty nifty way to create script-based applications without the need for whole development suites. In fact, seeing as Notepad++ is my tool of choice - it’s a no-brainer.

A lot of custom scripts should never need to be written once I’ve finished a suite of Active Directory tools. The first one is the most useful, a tool to create users automatically on a domain. Now I’m working on a tool to enumerate all users in a domain and empower the user to either enable or disable an account, as well as reset the password and change obvious settings like requiring the user to change passwords, alter group membership and bits like that.

The only downer is that there’s no real way to compile the app once it’s complete. Well, none that I know of.