Windows Tech Support

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Wednesday, 16 March 2011

Script/SCCM Upgrade Office 2007 to Office 2010

Posted on 10:16 by Unknown
There are a lot of ways to uninstall Office 2007 and install Office 2010, as well as many ways to combine them to effect an "upgrade".  Here's one I recently used that was clean, simple (ok, sort of simple) and reliable even when shoved through the entrails of SCCM advertisements onto XP and Windows 7 clients.  Note that the "custom.MSP" was created by using the Office Customization Toolkit.

Watch out for word-wrapping!

CMD Script
@echo off
rem ****************************************************************
rem Filename..: setup.cmd
rem Author....: David M. Stein
rem Date......: 03/16/2011
rem Purpose...: install microsoft office 2010 (remove 2007 if found)
rem ****************************************************************
CLS
title Installing Office 2010
echo Installing Microsoft Office 2010...
SETLOCAL
set APPNAME=Office2010_x86
set LOG=%TMP%\%APPNAME%_install.log
rem set MSI=/quiet /norestart
echo %DATE% %TIME% installing... %APPNAME%... >%LOG%
echo %DATE% %TIME% source....... %~dps0 >>%LOG%
echo %DATE% %TIME% target....... %COMPUTERNAME% >>%LOG%
echo %DATE% %TIME% windir....... %WINDIR% >>%LOG%
echo %DATE% %TIME% progfiles.... %PROGRAMFILES% >>%LOG%
echo %DATE% %TIME% temp......... %TMP% >>%LOG%
echo INSTALL LOG: %LOG%
echo ----------------------------------------------- >>%LOG%
echo *** REMOVE OFFICE 2007 *** >>%LOG%
rem ------------------------------------------------
echo %DATE% %TIME% info: checking if office 2007 is installed... >>%LOG%
if exist "%ProgramFiles%\Microsoft Office\Office12\winword.exe" (
echo %DATE% %TIME% info: *** removing Office 2007... >>%LOG%
cscript /nologo "%~dps0uninstall2007.vbs" >>%LOG%
) else (
echo %DATE% %TIME% info: Office 2007 was not found on this compuer. >>%LOG%
)
echo ----------------------------------------------- >>%LOG%
echo *** INSTALL OFFICE 2010 *** >>%LOG%
echo %DATE% %TIME% info: app-log is %temp%\Microsoft Office Professional Plus Setup(*).txt >>%LOG%
echo %DATE% %TIME% command is "%~dps0setup.exe" /adminfile "%~dps0custom.MSP" /config "%~dps0ProPlus.WW\config.xml" >>%LOG%
rem --- intentional line break for blog post ---
"%~dps0setup.exe" /adminfile "%~dps0custom.MSP" /config "%~dps0ProPlus.WW\config.xml"
echo installation completed!
if %errorlevel%==0 (
echo %DATE% %TIME% info: installation was successful >>%LOG%
) else (
echo %DATE% %TIME% fail: exit code is %errorlevel% >>%LOG%
)
ENDLOCAL
exit %errorlevel%

VBScript File
Rather than using the setup.exe or direct msiexec /x options for doing the uninstall, I just crack my Indiana Jones whip on WMI and let it do the uninstall.  Only problem is that the "Uninstall()" method doesn't wait.  So I had to insert a process termination monitor (below) to watch for when "setup.exe" finishes before continuing on.

'**************************************************************** 
' Filename..: uninstall2007.vbs 
' Author....: David M. Stein 
' Date......: 03/16/2011 
' Purpose...: uninstall office professional 2007 
'**************************************************************** 
Dim query, objWMI, colSoftwareComponents, objSoftwareComponent  
Const strComputer = "."  


wscript.echo LogDate & " info: searching for office professional 2007..."  
query = "Select * from Win32_Product " & _
"Where Name = 'Microsoft Office Professional Plus 2007'"  

Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\cimv2")  

Set colSoftwareComponents = objWMI.ExecQuery (query)  
For each objSoftwareComponent in colSoftwareComponents
found = True
wscript.echo LogDate & " info: removing office professional 2007..."
objSoftwareComponent.Uninstall()
Next

If found = True Then
' this is where we setup a watch to wait for setup.exe to finish...
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") 
query = "SELECT ProcessId FROM Win32_Process WHERE Name='setup.exe'"
Set colItems = objWMIService.ExecQuery(query,,48)
For Each objItem in colItems
intProcessID = objItem.ProcessId
Next
If intProcessID <> "" Then
Set colMonitoredProcesses = objWMIService.ExecNotificationQuery _
("Select * From __InstanceDeletionEvent Within 1 Where " & _
"TargetInstance ISA 'Win32_Process'")
Do Until bTerminated = True
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.ProcessID = intProcessID Then
bTerminated = True
End If
Loop
If bTerminated = True Then
wscript.echo LogDate & " info: office professional 2007 uninstalled" wscript.echo LogDate & " info: exit code is " & err.Number
Else
' yes, I know this condition can never be true, oh well.
wscript.echo LogDate & " warn: setup.exe process failed to terminate." End If
Else
wscript.echo LogDate & " warn: unable to obtain processID handle"
End If
Else
wscript.echo LogDate & " info: office professional 2007 was not found"
End If


'---------------------------------------------------------------- 
' comment: 
'----------------------------------------------------------------
Function LogDate()
LogDate = FormatDateTime(Now, vbShortDate) & " " & _
FormatDateTime(Now, vbLongTime) 
End Function


So when you call the .CMD script, it launches the .VBS script and checks for Office 2007 and (if found) uninstalls it, then returns to the .CMD script process to finish installing Office 2010.  So far, so good.  I hope this helps someone else out there.
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in installation, office, sccm, scripting, software deployment | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • Voting Time: Help Me Out?
    I need to get a better view of how I should manage this blog if I'm going to keep at it. I'd like to know how you typically discover...
  • A World Without Competition
    Try to imagine what things would be like today had there not been fierce competition in certain key parts of our world.  I’ll give you some ...
  • Book Update
    I posted some gibberish a few weeks ago about another book project.  Well, I'm getting close to wrapping it up, so I thought I'd go ...
  • Cost
    Software technology, like any technology, provides a means to solving problems.  Some big. Some small.  Some that help.  Some that hurt.  An...
  • Windows 7: Default User vs All Users
    A lot of confusion seems to occur with understanding the difference between the "Default User" profile, and the "All Users...
  • Time to Give Props
    With the ever-expanding volume and breadth of information on the Internet today, it's easy to focus on my own thoughts, experiences, ide...
  • Table of Contents (Preliminary)
    Here's the preliminary Table of Contents for my new book "The AutoCAD Network Administrator's Bible - 2013 Edition".  I...
  • The Nicest IT and IT Vendor Folks I Know
    I've ranted many times before how it's unfair to "hate" an entire company, without providing a rationale for it based on s...
  • Windows 8
    Two small, yet irritating things, that I hope Windows 8 addresses with respect to Windows 7: Being able to put the Recycle Bin in the S...
  • Stupid Assumptions
    After years of watching sci-fi TV shows, movies, etc. it's finally come to a point where even the so-called brightest of our authors and...

Categories

  • a
  • activation
  • active directory
  • advertising
  • agile
  • agility
  • amazon
  • american
  • apple
  • application virtualization
  • applications
  • art
  • articles
  • asp
  • augi
  • authors
  • autocad
  • AutoCAD Autodesk
  • autodesk
  • autolisp
  • automation
  • automotive
  • backups
  • batch
  • beer
  • beta
  • blackberry
  • blogs
  • bongloads
  • book
  • books
  • Books writing kindle amazon technology business projects
  • browsers
  • business
  • cad
  • career
  • certification
  • chrome
  • city government
  • civilization
  • cloud services
  • cmd
  • cmmi
  • comedy
  • command
  • community
  • computers
  • conferences
  • config manager
  • consultants
  • consulting
  • contracting
  • cranium drainium
  • crapware
  • culture
  • data center
  • data mining
  • databases
  • deployment
  • directx
  • DLL
  • domains
  • dumb
  • earth
  • economy
  • editor
  • education
  • election
  • elections
  • employment
  • engineering
  • entertainment
  • environment
  • error monitoring
  • events
  • exchange
  • facebook
  • family
  • firefox
  • flexnet
  • fud
  • fun
  • funny
  • games
  • gary vaynerchuk
  • gmail
  • google
  • government
  • group policy
  • hampton roads
  • health
  • history
  • holidays
  • home
  • html5
  • humor
  • hyper-v
  • iis
  • industry
  • infrastructure
  • installation
  • installshield
  • internet
  • internet explorer
  • interviews
  • jobs
  • jtbworld
  • kindle
  • kixtart
  • lab setup
  • languages
  • ldap
  • learning
  • legal
  • licensing
  • life
  • lifecycle
  • linux
  • lisp
  • logging
  • management
  • manufacturing
  • marketing
  • markets
  • mdop
  • mdt
  • medical
  • messaging
  • microsoft
  • microsoft access
  • military
  • mountains
  • movies
  • mozilla
  • music
  • nature
  • network administration
  • news
  • nook
  • nothing
  • office
  • open source
  • openoffice
  • opera
  • operating systems
  • oracle
  • osx
  • packaging
  • patches
  • people
  • photos
  • podcasts
  • policy
  • politics
  • powershell
  • predictions
  • process automation
  • products
  • programming
  • projects
  • psychology
  • publishing
  • rail
  • reading
  • registry
  • religion
  • reporting
  • reviews
  • rsat
  • rss
  • safari
  • safety
  • sales
  • satire
  • sccm
  • scheduling
  • science
  • scripting
  • search
  • security
  • servers
  • services
  • sharepoint
  • shopping
  • sms
  • social stuff
  • society
  • softgrid
  • software assurance
  • software deployment
  • software development
  • software packaging
  • sony
  • speaking
  • sports
  • sql express
  • sql server
  • statistics
  • Statistics news marketing
  • steve jobs
  • stories
  • stuff
  • stupidity
  • symantec
  • sysinternals
  • system center
  • systems architecture
  • t-sql
  • taxes
  • technet
  • technical support
  • technology
  • TED
  • ted talks
  • testing
  • textpad
  • thoughts
  • traffic
  • training
  • transportation
  • travel
  • troubleshooting
  • tutorials
  • twitter
  • ubuntu
  • unattend
  • unemployment
  • updates
  • upfront ezine
  • utilities
  • vacation
  • vba
  • vbscript
  • video
  • virginia
  • virginia beach
  • virtualization
  • visual lisp
  • vmware
  • vmware server
  • voting
  • war
  • weather
  • web
  • web browsers
  • web development
  • web sites
  • windows
  • windows 7
  • windows live
  • windows server
  • windows server 2012
  • windows8
  • winpe
  • wise
  • wmi
  • work
  • writing
  • ws08
  • wsus
  • wwa
  • x64
  • xml
  • ze frank

Blog Archive

  • ►  2013 (37)
    • ►  October (1)
    • ►  September (5)
    • ►  August (8)
    • ►  July (2)
    • ►  June (4)
    • ►  May (4)
    • ►  April (2)
    • ►  March (2)
    • ►  February (8)
    • ►  January (1)
  • ►  2012 (120)
    • ►  December (14)
    • ►  November (12)
    • ►  October (10)
    • ►  September (7)
    • ►  August (3)
    • ►  July (2)
    • ►  June (6)
    • ►  May (6)
    • ►  April (20)
    • ►  March (16)
    • ►  February (18)
    • ►  January (6)
  • ▼  2011 (343)
    • ►  December (15)
    • ►  November (23)
    • ►  October (27)
    • ►  September (35)
    • ►  August (29)
    • ►  July (17)
    • ►  June (23)
    • ►  May (20)
    • ►  April (38)
    • ▼  March (61)
      • The AutoCAD Network Administrator's Bible - 2012 E...
      • Reminding Yourself That Not Every Problem has a So...
      • How My Brain (sort of) Works
      • The AutoCAD Network Administrator's Bible - 2012 E...
      • Desktop vs Mobile: What Won't Change
      • Ralph Grabowski - What's Inside? AutoCAD 2012 ebook
      • Owen Wengerd on Muzzling AutoCAD 2012 InfoCenter
      • RIP Windows XP
      • AutoCAD 2012 VBA Enabler
      • Addendum to Packaging DirectX for AutoCAD 2012
      • Reverse Engineering AutoCAD 2012 Deployment INI Files
      • Package DirectX for AutoCAD 2012 and Wise Package ...
      • AutoCAD 2012 Network Deployments and SCCM
      • WWA: Toasted and Done
      • The Basis of a Base Image
      • SCCM 2012 Beta 2 is Now Available
      • Tech's Biggest Eaters
      • What does DCDIAG actually… do? - Ask the Directory...
      • PDF Sucks - eBooks Rule
      • Technical Books
      • History Always Repeats - but we only have a Pinhol...
      • I'm Not Kidding. I really have no life
      • Why I was Wrong: Part 2b
      • Five (5) Myths of Modern IT
      • WWA Code Freeze - Part 2
      • Code Freeze
      • A Book of Books
      • I Was Wrong
      • WWA build 2011.03.16.002 - Updated Screen Shots
      • Script/SCCM Upgrade Office 2007 to Office 2010
      • Managing Windows, AD and SCCM via the Web?
      • WWA Project Web Site is up
      • WWA Development Notes
      • More Screen Captures
      • Screen Shots of Windows Web Admin
      • Change of Direction: SCCM Web Admin to Web Admin?
      • App-V 4.6 SP1: SFTLIST crashes during Windows 7 SP...
      • Sequencing AutoCAD 2008 with App-V 4.6 SP1
      • State of the Blog
      • Software Deployment Methods Compared
      • Correcting Myself. Again.
      • SCCM Web Admin Project (update)
      • SCCM Web Admin Project
      • SCCM Deployment Program Sequencing
      • Three Days without my Server
      • Made in 'merica
      • The Love/Hate of Technology
      • Groceries
      • My Interview with some Extreme Visionaries
      • Google CR-48 Chrome Book - More Thoughts on my Tri...
      • Beware Kindle Book Ratings
      • Do's and Don'ts from the Field
      • Useless Data: Average Daily Work E-mail Volume
      • Preparing to Migrate from XP to Windows 7 in a Dom...
      • Happy Birthday Blog
      • The Social Network vs. the Book
      • What I've Accomplished This Week
      • Business and IT Stupidity
      • IT Support 101
      • Irony or Ignorance?
      • Facebook
    • ►  February (54)
    • ►  January (1)
Powered by Blogger.

About Me

Unknown
View my complete profile