Jump to content


raha_ang

Established Members
  • Posts

    6
  • Joined

  • Last visited

About raha_ang

  • Birthday 04/29/1987

Profile Information

  • Gender
    Male
  • Location
    Sydney, NSW, Australia
  • Interests
    The Mighty South Sydney Rabbitohs!!!

raha_ang's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Looking at the above script I pasted, I believe this is the section where the magic happens. Function 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 Function The script installs the new version and adds the reg settings but doesnt uninstall the old version in between. Any ideas how I can include a step in between the two to run this command? msiexec /x {205CFDD2-34CF-4141-93AA-55FCDB7BB012} /q
  2. 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 Explicit Dim ObjShell, ReturnVal, ExistingVersion, ProductCode, objWMIService, objProcess, colProcess, ProcessesFound, temp, x, ProductNameTemp Set ObjShell = CreateObject("WScript.Shell") KillProcess("outlook.exe") install x= 0 Dim 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 if Next wscript.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 If End Function Function 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 Next End Function Function LogError (Message) ObjShell.LogEvent 1, "Installation Error: " & Message & " MSI Return Code: " & ReturnVal WScript.Quit ReturnVal End Function Function 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 Function Function 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 Next End Function Function installShield Dim strComputer, objReg, objWMIService, colItems, objItem, i, arrFind, strKeyPath, strEntryName, strValue Const HKEY_CLASSES_ROOT = &H80000000 'On Error Resume Next Set 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 If Next End Function
  3. 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
  4. Awesome thanks Keith, will do! Havent done much work with scripting before hence why I said im new to this stuff and came here to ask
  5. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.