Announcement

Collapse
No announcement yet.

Need help with a script to uninstall Access from Office 2003pro

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help with a script to uninstall Access from Office 2003pro

    I just found out that we are not licensed for office 2003 pro but only office 2003 standard. My local MS rep said that if I could uninstall access and I would be OK. I have 150 office 2003 pro installations and I'm looking for a way to write a script to just uninstall access from the office 2003 suite (so I won't have to spend every night next week doing it manually). I'm a newbee at scripting, so any help would be appreciated. Thanks!

  • #2
    Re: Script to Auto Remove Microsoft Office 2003 Pro

    Had a long look into this but i cant find an uninstall thread in the registry to remove access ONLY from Microsoft Office 2003 Pro. (Not sure there is one at all).

    From a scripting point of view the only solution i can think of is to remove Microsoft Office XP pro and Install Office XP Small Business Edition with a single Script.

    As per the rules high-lighted for this forum i dont think i can legally give you a script to install Microsoft Office XP Small Buisness Edition but i can give you the script to remove Microsoft Office 2003 Pro. And i can tell you, if you have the original CD's for Office XP Small Buisness Edition it shows you in the installation folder how to create an automated script. And if you dont want to do that then at least the script attached might save you half the administration time.

    ---------------------------------------------------------------
    SCENARIO: To Remove Microsoft Office 2003 Pro

    REASON: To Reduce Administration Time

    CODE: (Attached)

    * N.B - Be sure to set the timers between Send Keys in the script to the slowest machine on your network. I already set the timers quite high as i was trying this on a very slow machine but try it out first yourself before applying to existing Script or GPO.
    --------------------------------------------------------------
    ...Let me know how you get on too.

    David
    Attached Files

    Comment


    • #3
      Re: Need help with a script to uninstall Access from Office 2003pro

      Thanks for your help! This saves me at least half the time!

      Comment


      • #4
        Re: Need help with a script to uninstall Access from Office 2003pro

        Your Welcome, always a pleasure to work on scripts!

        Comment


        • #5
          Re: Need help with a script to uninstall Access from Office 2003pro

          Be carefull using sendkeys just like that. When the user changes window focus or he or she closes the application, the script will continue to send the keystrokes to wrong window.

          It is best to use 'AppActivate' and 'If AppActivate' before every sendkey. (where in the example below 'strProcName' is the name of the application window. Note, that the windowname might change during the process)

          Code:
          strProcName = "Microsoft Office 2003 Setup"
          While sh.AppActivate(strProcName) = FALSE
          ' wait untill strProcName is loaded
          sh.AppActivate(strProcname)
          Wend
          
          'Send keys
          sh.AppActivate(strProcname)
          If sh.AppActivate(strProcname) = True Then sh.SendKeys "U"

          The command string "MsiExec.exe /I{=CLSID=}" is in fact an installation string.
          By running this command string, the already installed Office version, opens a option menu window, where you can use the sendkeys to select and run the uninstall process. You can use sendkeys to go through any option.

          If you want to un-install a program, normally you would use MsiExec.exe /x{=CLSID=} instead of the MsiExec.exe /i command;
          Code:
          MsiExec.exe /x{90110409-6000-11D3-8CFE-0150048383C9} /quiet /passive /norestart
          If this uninstallation command string is working for the office version, there is no need any more to use sendkeys.
          The CLSID of an installed program can be found in one of the subkeys of the following registry key:
          Use 'Find' to search in this registry key for the Display Name of the program you want to uninstall.
          Code:
          HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall

          An other way to uninstall a program is using the Win32_Product Windows Management Instrumentation class:
          - "Delete software on a computer by script"


          A way to remove Office features;
          - "How to use the Custom Maintenance Wizard to add or remove Office features"



          \Rems

          This posting is provided "AS IS" with no warranties, and confers no rights.

          __________________

          ** Remember to give credit where credit's due **
          and leave Reputation Points for meaningful posts

          Comment


          • #6
            Re: Need help with a script to uninstall Access from Office 2003pro

            Rems,

            Yes. The "MsiExec.exe" command works just fine. No need at all for the send Keys in the first place.

            "MsiExec.exe /x{90110409-6000-11D3-8CFE-0150048383C9} /quiet /passive /norestart"

            Thanks for that. Will keep it mind for future.

            Apologies for posting a crude method... new to scripts. Getting better as the days go on!!!

            David

            Comment


            • #7
              Re: Need help with a script to uninstall Access from Office 2003pro

              Thanks for that. Will keep it mind for future.
              Apologies for posting a crude method... new to scripts. Getting better as the days go on!!!
              Your Welcome!

              People writing scripts learn from each other how to tackle as many error factors as we can think of. The perfect script does not exist or does not last forever.
              It won't always be nessesary in every situation to use all of these know-how in one script. And I often can't even remember the ones that I already knew. So feel free to send any pointers or comments to my scripts too, it would be much appreciated.

              Happy scripting Dave. Glad to have you here on this forum!

              \Rems




              Code:
              ' Although the use of SendKeys must be considered as fragile, 
              ' here are some basic tips; 
              
              ' be extra carefull when sending an 'Enter' with sendkeys.
              ' (sometime you can workaround that using a key+keys combination/sequence)
              
              
              strProcName = "name of task"  '(Application's *Taskname*, check Taskmanager)
              
              'NOTES, 
              '1. For some applications the 'name of the task' that needs action, 
              '   can change a long the way.
              
              '2. A better way to controll the app, would be to determine the unique 
              '   PID of the running application instead of using the taskname. 
              '   In that case, change the variable strProcName to use the PID
              '
              '   you can retrieve the PID by starting the app by vbs in a method that
              '   returns the PID  or via comparing the command-line of the
              '   running app using WMI: objProcess.commandline.
              
              
              Set objShell = WScript.CreateObject("WScript.Shell")
              
              ' Wait until strProcName is loaded
              iTimeout = 30 'seconds
              While (objShell.AppActivate(strProcName) = False)
                wscript.sleep 1000
                objShell.AppActivate(strProcname)
                iTimeout = iTimeout - 1
                If iTimeout < 0 then wsh.quit
              Wend
              
              ' S E T T I N G  T H E  F O C U S
              ' AppActivate() do set the focus to 
              ' the application (if it is running), 
              ' but having focus does not implicate the application 
              ' is now visible in a Window. 
              ' If the app is Minimized, it will stay minimized!
              ' then sending keys won't have always the expected results!!
              
              
              '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Maximize []
              'This part of the code will
              'bring the strProcName window up to front ("M"=Maximize window), 
              'You only need to do this when the application was minimized.
              '( note, you could also choose the "R" =Restore option, but this letter
              '  is OS_language depended, for other countries this could be 
              '  a "V" or something else )
              Wscript.sleep 100
              objShell.AppActivate(strProcName)
              If objShell.AppActivate(strProcName) = True  then _
                 objShell.SendKeys "(% )"
              Wscript.sleep 5
              objShell.AppActivate(strProcName)
              If objShell.AppActivate(strProcName) = True  then _
                 objShell.SendKeys "M"
              
                ' J u s t  c h e c k I N G ;
                objShell.SendKeys "^" : wscript.sleep 5   'Dummy command
                wscript.echo "check"
              
              
              '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Minimize [-]
              Wscript.sleep 100
              objShell.AppActivate(strProcName)
              If objShell.AppActivate(strProcName) = True  then _
                 objShell.SendKeys "(% )"
              Wscript.sleep 5
              objShell.AppActivate(strProcName)
              If objShell.AppActivate(strProcName) = True  then _
                 objShell.SendKeys "N"
              
                ' J u s t  c h e c k I N G ;
                objShell.SendKeys "^" : wscript.sleep 5   'Dummy command
                wscript.echo "check"
              
              
              '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Close [X]
              'this will close the application, EVEN if the app window was minimized
              Wscript.sleep 100
               objShell.AppActivate(strProcName)
              If objShell.AppActivate(strProcName) = True  then _
                 objShell.SendKeys "(% )"
              Wscript.sleep 5
              objShell.AppActivate(strProcName)
              If objShell.AppActivate(strProcName) = True  then _
                 objShell.SendKeys "S"
              
              'Dummy command - is to return focus back to the script (!)
              objShell.SendKeys "^" : wscript.sleep 5
              Dummy commands helps wscript popups to appear upfront again.
              Tricks you can use;
              - objShell.SendKeys sending "Ctrl" ("^" )
              - objShell.Run(chr(34)),1,False OR objShell.Run("."),1,False

              (the two objShell.Run methods from above are sending (the same) Windows Explorer command. It can happen that explorer wil popup, this is harmless)
              Last edited by Rems; 28th December 2007, 13:24.

              This posting is provided "AS IS" with no warranties, and confers no rights.

              __________________

              ** Remember to give credit where credit's due **
              and leave Reputation Points for meaningful posts

              Comment

              Working...
              X