raha_ang Posted September 25, 2013 Report post Posted September 25, 2013 Hey Guys!!! I apologise in advance if this is a stupid question, I'm quite new to this stuff so please go easy on me I have been given the task of rolling out a software upgrade for a piece of company software. Basically what needs to happen is (in this order): 1. Install a file from an MSI ( I have been given the MSI file which is in the SMS server package store ) 2. Run this script "C:\Windows\System32>MsiExec.exe /x {205CFDD2-34CF-4141-93AA-55FCDB7BB012} /q" (uninstalls the old one) 3. Run this RegKey file "regedit.exe /s \\aumxxxxxxxxx\smspkgg$\xxxxxxxx\settings.reg" (Adds the server settings to the new one - ATTACHED) Is there anyway to compile all these steps into one package where it can follow these steps? There are also 2 .mst files in the folder which im unsure of how to open to see what they are. Let me know if you need any further information. Settings - ANG.txt Quote Share this post Link to post Share on other sites More sharing options...
KeithDib Posted September 25, 2013 Report post Posted September 25, 2013 Hi Use a Task Sequence to combine the packages and advertise this to the machines Quote Share this post Link to post Share on other sites More sharing options...
raha_ang Posted September 25, 2013 Report post Posted September 25, 2013 Hi Use a Task Sequence to combine the packages and advertise this to the machines With all due respect... I have NOOO idea what youre talking about Quote Share this post Link to post Share on other sites More sharing options...
KeithDib Posted September 25, 2013 Report post Posted September 25, 2013 Hi Do a search on Google for SCCM Task Sequence's, there is plenty to read and they can do far more than the normal advertisements Quote Share this post Link to post Share on other sites More sharing options...
Bendes Posted September 25, 2013 Report post Posted September 25, 2013 oO Just create a script in your favorite language (DOS Batch, VBScript, ...) and run it from your Package/Program command line : - Batch: cmd.exe /C FileName.bat - VBScript: wscript.exe FileName.vbs Quote Share this post Link to post Share on other sites More sharing options...
raha_ang Posted September 26, 2013 Report post Posted September 26, 2013 Hi Do a search on Google for SCCM Task Sequence's, there is plenty to read and they can do far more than the normal advertisements Awesome thanks Keith, will do! oO Just create a script in your favorite language (DOS Batch, VBScript, ...) and run it from your Package/Program command line : - Batch: cmd.exe /C FileName.bat - VBScript: wscript.exe FileName.vbs Havent done much work with scripting before hence why I said im new to this stuff and came here to ask Quote Share this post Link to post Share on other sites More sharing options...
raha_ang Posted September 26, 2013 Report post Posted September 26, 2013 oO Just create a script in your favorite language (DOS Batch, VBScript, ...) and run it from your Package/Program command line : - Batch: cmd.exe /C FileName.bat - VBScript: wscript.exe FileName.vbs When I run the BAT file on the machine locally, CMD appears for a brief second and then closes and shortly after an icon appears called MsiExec.exe After that nothing happens and the program does not appear in the add remove programs as it should. Any ideas? C:\Windows\System32>MsiExec.exe /i "\\SERVERNAME\smssource$\Roomview Fusion\OutlookAddinSetup.msi" /qn /norestart /log "C:\Program Files\XXX\logging\FusionTest2.log" C:\Windows\System32>MsiExec.exe\MsiExec.exe /x {205CFDD2-34CF-4141-93AA-55FCDB7BB012} /q regedit.exe /s \\SERVERNAME\smspkgg$\XXX0028B\settings.reg Quote Share this post Link to post Share on other sites More sharing options...
Rocket Man Posted September 26, 2013 Report post Posted September 26, 2013 How about this: msiexec /i "%~dp0OutlookAddinSetup.msi" /qn /norestart /log "C:\Program Files\XXX\logging\FusionTest2.log" msiexec /x {205CFDD2-34CF-4141-93AA-55FCDB7BB012} /q regedit.exe /s %~dp0settings.reg have all of the files in one folder including the batchfile that executes it. To test have it on a share and UNC to it and run the batch file. If it works create a package/application from it. The program command line will be the name of the batch file that executes the installs! Quote Share this post Link to post Share on other sites More sharing options...
raha_ang Posted September 27, 2013 Report post Posted September 27, 2013 Hey Rocket Man, Thanks for the reply. Still no luck. This is the VBS script that I was left with that doesnt work. It installs the new software but I dont think it does it in the right order so it doesnt work. - Install new version - Uninstall old version - Add reg settings ----------------- Option ExplicitDim ObjShell, ReturnVal, ExistingVersion, ProductCode, objWMIService, objProcess, colProcess, ProcessesFound, temp, x, ProductNameTempSet ObjShell = CreateObject("WScript.Shell")KillProcess("outlook.exe")install x= 0Dim ProductName(0)ProductName(0) = "Crestron RoomView Outlook Addin"KillProcess("outlook.exe")'Set ObjShell = CreateObject("WScript.Shell")For x=0 To UBound(ProductName) ProductNameTemp = ProductName(x) If Uninstall(GetProductCode(ProductNameTemp,32),ProductNameTemp,32) = "" Then If Uninstall(GetProductCode(ProductNameTemp,64),ProductNameTemp,64) = "" Then 'Error End If End ifNextwscript.quit(ReturnVal)Function Uninstall(ProductCode, ProductName, Regtype) On Error Resume Next Dim ExistingVersion If ProductCode <> "" Then ObjShell.LogEvent 4, "Found " & ProductName & " - " & ProductCode & " in " & Regtype & "-Bit" ReturnVal = ObjShell.run ("Msiexec.exe /x " & ProductCode & " /qn reboot=reallysuppress /lve " & Chr(34) & "C:\Program Files\GPT\logging\Uninstall -" & ProductName & ".log" & Chr(34), 1, True) If Not (ReturnVal = 0 Or ReturnVal = 3010) then LogError("Could not Uninstall " & ProductName & "!") Uninstall = ReturnVal Else ObjShell.LogEvent 4, "No product code supplied for product: " & ProductName & " - in " & RegType & "bit , no search will be done" End IfEnd FunctionFunction GetProductCode(strName,Regtype) Dim oCtx, oLocator, oReg, oInParams, oOutParams, arrValueNames, strValue, key, i, newkey Const HKEY_LOCAL_MACHINE = &H80000002 Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet") oCtx.Add "__ProviderArchitecture", Regtype Set oLocator = CreateObject("Wbemscripting.SWbemLocator") Set oReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv") Key = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" oReg.EnumKey HKEY_LOCAL_MACHINE, Key, arrValueNames For I=0 To UBound(arrValueNames) newkey = key & "\" & arrValueNames(I) oReg.GetStringValue HKEY_LOCAL_MACHINE,newkey,"DisplayName",strValue Dim temp1 temp1 = InStr(LCase(strValue), LCase(strName)) If InStr(LCase(strValue), LCase(strName)) > 0 Then If InStr(LCase(strValue), LCase(strName)) = 1 Then oReg.GetStringValue HKEY_LOCAL_MACHINE,newkey,"UninstallString",strValue If strValue <> "" Then GetProductCode = Replace(Replace(Replace(Replace(UCase(strValue), "MSIEXEC.EXE /X",""), "MSIEXEC.EXE /I",""), "MSIEXEC /X",""), "MSIEXEC /I","") ObjShell.LogEvent 4, "Uninstall String Found: " & GetProductCode End If End If End If NextEnd FunctionFunction LogError (Message) ObjShell.LogEvent 1, "Installation Error: " & Message & " MSI Return Code: " & ReturnVal WScript.Quit ReturnValEnd FunctionFunction install ReturnVal = ObjShell.run ("msiexec /I ""OutlookAddinSetup.msi"" /qn /lve ""C:\Program Files\GPT\logging\RoomViewFusion.log""", 0, True) If Not (ReturnVal = 0 Or ReturnVal = 3010) then LogError("RoomViewFusion! ReturnCode:" & ReturnVal) 'ReturnVal = ObjShell.run ("regedit /s settings.reg", 0, True) 'If Not (ReturnVal = 0 Or ReturnVal = 3010) then LogError("RoomViewFusion! ReturnCode:" & ReturnVal)End FunctionFunction KillProcess(strProcess) Dim Process, strObject, objProcess, IsProcessRunning, strComputer IsProcessRunning = False strComputer = "." For Each Process in GetObject( strObject ).InstancesOf( "win32_process" ) If UCase( Process.name ) = UCase( strProcess ) Then IsProcessRunning = True Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = '" & strProcess & "'" ) For Each objProcess in colProcess objProcess.Terminate() Next Exit For else End If NextEnd FunctionFunction installShieldDim strComputer, objReg, objWMIService, colItems, objItem, i, arrFind, strKeyPath, strEntryName, strValueConst HKEY_CLASSES_ROOT = &H80000000'On Error Resume NextSet objShell = CreateObject("WScript.Shell")strComputer = "."Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colItems = objWMIService.ExecQuery("Select * from Win32_DCOMApplicationSetting",,48)For Each objItem in colItems If objItem.Description <> "" Then arrFind=Split(objItem.Description) For i=0 To UBound(arrFind) If lcase(arrFind(i))="installshield" Then strKeyPath = "AppID\" & objItem.AppID strEntryName = "RunAs" strValue = "" objReg.DeleteValue HKEY_CLASSES_ROOT,strKeyPath,strEntryName End If Next End IfNextEnd Function Quote Share this post Link to post Share on other sites More sharing options...
kvineets Posted September 27, 2013 Report post Posted September 27, 2013 For a new you version , you would have msi. so create a program for that msiexec /i "application" /qb! For removing old version , create a script file which will check the product codes and remove and create another program with cscript "uninstall.vbs" chain this previous program where this will run first and for registery create another program chain it with above prorgam. Quote Share this post Link to post Share on other sites More sharing options...