Showing posts with label installation. Show all posts
Showing posts with label installation. Show all posts

Tuesday, February 15, 2011

Template CMD Script for App Installs

This is obviously bare-bones and will need to be modified to suit specific implementations.  There are dozens of ways to execute a software installation, including setup.exe files, extracting ZIP and other archive files, registering DLLs with REGSVR32, and the ugly-ass, vice-grip + screwdriver + duct tape approach where you manually build folder trees, copy files, register DLLs, add and modify registry keys and make or replace shortcuts.  Oh, the torture.

EDIT: Updated 7/30/2011 to include errorlevel 3010 (reboot pending)


@echo off
rem ****************************************************************
rem  Filename..: setup.cmd
rem  Author....: David M. Stein
rem  Date......: 07/30/2011
rem  Purpose...: install apps in controlled sequence
rem ****************************************************************
rem Additional Notes:
rem
rem ****************************************************************
title Installing Applications
CLS
echo Installing Applications...
SETLOCAL
set APPNAME=MyApplicationSuite2011
set LOG=%TMP%\%APPNAME%_install.log
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 *** APPLICATION NAME 1 >>%LOG%
echo %DATE% %TIME% info: checking if application is already installed... >>%LOG%
if exist "%ProgramFiles%\FolderName\filename.exe" (
echo %DATE% %TIME% info: ## application is already installed >>%LOG%
) else (
echo %DATE% %TIME% info: ## installing application... >>%LOG%
echo %DATE% %TIME% command = msiexec /i "%~dps0Folder\filename.msi" TRANSFORMS="%~dps0Folder\filename.MST" >>%LOG%
   msiexec /i "%~dps0Folder\filename.msi" TRANSFORMS="%~dps0Folder\filename.MST" %MSI%
   if %errorlevel%==0 (
      echo %DATE% %TIME% info: installation SUCCESSFUL >>%LOG%
   ) else (
      if %errorlevel%==3010 (
         echo %DATE% %TIME% info: installation SUCCESSFUL [reboot pending] >>%LOG%
      ) else (
         echo %DATE% %TIME% file: exit code is %errorlevel% >>%LOG%
         rem Raise error to parent process!!
         exit %errorlevel%
      )

   )
)
rem ------------------------------------------------
rem echo *** APPLICATION NAME 2 >>%LOG%
rem ------------------------------------------------
rem
rem repeat code above with modifications as needed
rem
rem ------------------------------------------------
echo %DATE% %TIME% info: adjusting application folder permissions... >>%LOG%
cacls "%ProgramFiles%\FolderName" /T /E /C /G Users:C
echo ----------------------------------------------- >>%LOG%
echo %DATE% %TIME% info: applying attachmate file association fix... >>%LOG%
REG DEL HKCR\.xxx /f
REG ADD HKCR\.xxx /ve /d "ApplicationClass.ProgName.1" /f
echo ----------------------------------------------- >>%LOG%
echo %DATE% %TIME% info: adjusting registry permissions... >>%LOG%
REGINI.exe %~dps0customregsettings.ini
echo ----------------------------------------------- >>%LOG%
echo %DATE% %TIME% completed! result code: %errorlevel% >>%LOG%
ENDLOCAL
rem Raise error to parent process!!
exit %errorlevel%

Sunday, December 12, 2010

Uninstall: 3DS Max 2010

CMD Script…


@echo off
CLS
SETLOCAL
set APPNAME=3dsMax2010
set LOG=%TMP%\%APPNAME%_uninstall.log
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 ----------------------------------------------- >>%LOG%
echo Checking if 3ds Max 2010 is installed >>%LOG%
if exist "%programfiles%\Autodesk\3ds Max 2010" GoTo REMOVE
goto NOTFOUND
goto END

:NOTFOUND
echo %DATE% %TIME% 3DS Max 2010 was not detected on this computer
goto END

:REMOVE
echo %DATE% %TIME% removing 3ds Max 2010 32-bit >>%TMP%\3dsmax2010uninst.log
echo command = msiexec.exe /x {317AC0C7-FEBF-0409-87A3-4FC70D0ED900} %MSI% >>%LOG%
msiexec.exe /x {317AC0C7-FEBF-0409-87A3-4FC70D0ED900} %MSI%
rem ------------------------------------------------------
echo %DATE% %TIME% removing 3ds Max 2010 32-bit Components >>%TMP%\3dsmax2010uninst.log
echo command = msiexec.exe /x {60A08432-00DD-0409-AC2C-143C75460878} %MSI% >>%LOG%
msiexec.exe /x {60A08432-00DD-0409-AC2C-143C75460878} %MSI%
rem ------------------------------------------------------
echo %DATE% %TIME% removing Backburner 2008.01 >>%TMP%\3dsmax2010uninst.log
echo command = msiexec.exe /x {3D347E6D-5A03-4342-B5BA-6A771885F379} %MSI% >>%LOG%
msiexec.exe /x {3D347E6D-5A03-4342-B5BA-6A771885F379} %MSI%
rem ------------------------------------------------------
echo %DATE% %TIME% removing Tutorials Files >>%TMP%\3dsmax2010uninst.log
echo command = msiexec.exe /x {E551D82D-4D56-4AF7-A2C9-8897D7A0CB00} %MSI% >>%LOG%
msiexec.exe /x {E551D82D-4D56-4AF7-A2C9-8897D7A0CB00} %MSI%
rem ------------------------------------------------------
echo %DATE% %TIME% removing FBX Plugin 2009.4 - 3ds Max 2010 >>%TMP%\3dsmax2010uninst.log
c:
cd "%programfiles%\Autodesk\"
echo command = "FBX\FBXPlugins\2009.4\3ds Max 2010\Uninstall.exe" /S >>%LOG%
"FBX\FBXPlugins\2009.4\3ds Max 2010\Uninstall.exe" /S
goto CLEANUP
goto END

:CLEANUP
echo %DATE% %TIME% cleaning up leftover folders and files >>%LOG%
c:
if exist "%programfiles%\Autodesk\3ds Max 2010" (
echo Removing 3ds Max 2010 sub-folder >>%LOG%
cd "%programfiles%\Autodesk"
rd "3ds Max 2010" /s /q
)
if exist "%programfiles%\Autodesk\FBX" (
echo Removing FBX sub-folder >>%LOG%
cd "%programfiles%\Autodesk"
rd "FBX" /s /q
)
rem ------------------------------------------------------
echo %DATE% %TIME% exit code %errorlevel% >>%LOG%
echo %DATE% %TIME% completed >>%LOG%
goto END

:END
exit %errorlevel%

Tuesday, July 20, 2010

MS Security Essentials vNext Silent Install

The new Microsoft Security Essentials is out in beta, and here's how to install it silently using a VBscript.  You still need to tweak it for UAC unless you adapt the command string for use within something else like ConfigMgr.  Enjoy…

const x86 = "mseinstall_en_us_x86.exe"
const x64 = "mseinstall_en_us_amd64.exe"

Function ScriptPath()
ScriptPath = Replace(wscript.ScriptFullName, "\" & wscript.ScriptName, "")
End Function

Set fso = createobject("Scripting.FileSystemObject")
If fso.FolderExists("c:\Program Files (x86)") Then
cmd = x64
Else
cmd = x86
End If

cmdpath = ScriptPath() & "\" & cmd

If fso.FileExists(cmdpath) Then
Set objShell = CreateObject("Wscript.Shell")
objShell.Run cmdpath & " /s /runwgacheck /o", 1, True
Set objShell = Nothing
Else
wscript.echo cmdpath & " not found"
End If

Set fso = Nothing

Sunday, October 25, 2009

Windows 7 Clean Install using Upgrade Media

Just a slightly different spin to the post by Paul Thurrott about performing a clean install of Windows 7 using “upgrade” media without having to install XP or Vista first.  This just wraps the steps inside a .BAT script.  Make sure you read Paul’s article first or you’ll be lost.  Be sure to run this from a CMD console that was launched via “Run as Administrator” or it won’t work…

@echo off
rem the following line between the divider lines should NOT wrap!
rem --------------------------------
REG ADD "HKLM/Software/Microsoft/Windows/CurrentVersion/Setup/OOBE/" /v MediaBootInstall /d 1 /t REG_DWORD /f
rem --------------------------------
echo Registry key value has been set.
pause
slmgr /rearm
echo Activation skip-rearm has been set.
echo Press ENTER to reboot your computer now...
pause
shutdown -r -f -t 2