/build/static/layout/Breadcrumb_cap_w.png

Blog Posts by VBScab

Ask a question

Spectacular Microsoft fail - SQL Server installation

I am stunned, given the robust way that the majority of MS tools which accept both command line and configuration file-driven arguments handle things, i.e. the command line overrides the configuration file, that the installer for SQL Server can be so spectacularly awful!

If you specify the '/Q' argument on the command line and your configuration file also contains an entry for 'UIMode', you will get this error:

Media ScenarioEngine.exe returned exit code: 0x858C001C

Crystal clear, right? Obscure text, meaningless error numbers...SMH...

Luckily, the log written to the bootstrap location (e.g. "C:\Program Files\Microsoft SQL Server\140\Setup Bootstrap\Log\Summary.txt") tells you what's happened:

The /UIMode setting cannot be used in conjunction with /Q or /QS

Also luckily, I always use the extracted MSIs to install this junk so am able to work around this nonsense but I just thought I might save some other poor soul the heartache and wasted hours trying to decipher what the Hell prevents it working.

Be the first to comment

Q&D method of getting an MSI's ProductCode

I know I'm supposed to have retired from ITN but well, I thought I'd share one last thing.

When you're writing scripts or adding MSIs to SCCM or whatever, what a monumental pain it is to have to load the MSI into Orca/InstEdit, scroll to the Properties table then scroll to the ProductCode property, eh? Well, no more! Here's a script which will echo that property to the screen and copy it to the clipboard, ready for pasting to...wherever you fancy. Plus, I've even created a .REG for you that adds the script to Explorer's context menu. Obviously, you'll need to edit the script path in the .REG.

To answer the inevitable question, no, there is no guarantee, warranty or support of any kind.

REGEDIT4

[HKEY_CLASSES_ROOT\Msi.Package\shell\GetProductCode]
@="Get Product &Code"

[HKEY_CLASSES_ROOT\Msi.Package\shell\GetProductCode\command]
@="cscript c:\\windows\\syswow64\\GetProductCode.VBS \"%1%\""

.VBS:

Option Explicit

Dim blnResult
Dim strMSI
Dim strCode

strMSI   = WScript.Arguments(0)
If Len(strMSI) = 0 Then
 WScript.Quit(False)
End If

blnResult  = GetMSIProductCode(strMSI, strCode)
If blnResult Then
 WScript.Echo strMSI & "'s ProductCode is " & strCode
 blnResult = CopyToClipboard(strCode)
End If

Function GetMSIProductCode(ByVal strMSIFile, ByRef strProductCode)
 Const intMSI_OpenDatabaseModeReadOnly  = 0  '// Opens a database read-only, no persistent changes
 Const intMSI_OpenDatabaseModeTransact  = 1  '// Opens a database read/write in transaction mode
 Const intMSI_OpenDatabaseModeDirect  = 2  '// Opens a database direct read/write without transaction
 Const intMSI_OpenDatabaseModeCreate  = 3  '// Creates a new database, transact mode read/write
 Const intMSI_OpenDatabaseModeCreateDirect = 4  '// Creates a new database, direct mode read/write
 Const intMSI_OpenDatabaseModeListScript  = 5  '// Opens a database to view advertise script files, such as the files generated by the CreateAdvertiseScript method
 Const intMSI_OpenDatabaseModePatchFile  = 32  '// Adds this flag to indicate a patch file

 GetMSIProductCode = False
 
 If strMSIFile = "" Then
  Exit Function
 End If
 
 Dim objInstaller
 Dim objDatabase
 Dim objView
 Dim objRecord

 On Error Resume Next
 Set objInstaller  = CreateObject("WindowsInstaller.Installer")
 If Not IsObject(objInstaller) Then
  Exit Function
 End If
 
 Set objDatabase  = objInstaller.OpenDatabase(strMSIFile, intMSI_OpenDatabaseModeReadOnly)
 If Err.Number Then
  Exit Function
 End If
 
 Set objView   = objDatabase.OpenView("Select `Value` From Property WHERE `Property` ='ProductCode'")
 objView.Execute

 Set objRecord   = objView.Fetch
 If Not objRecord Is Nothing Then
  strProductCode = objRecord.StringData(1)
  GetMSIProductCode = True
 End If

 Set objRecord   = Nothing
 Set objView   = Nothing
 Set objDatabase  = Nothing
 Set objInstaller  = Nothing
End Function

Function CopyToClipboard(ByVal strText)
 Dim objIE
 
 CopyToClipboard   = False
 
 Set objIE    = CreateObject("InternetExplorer.Application")
 If Not IsObject(objIE) Then
  Exit Function
 End If
 
 With objIE
  .Navigate("about:blank")
  .document.parentwindow.clipboardData.SetData "text", strText
  .Quit
 End With
 
 CopyToClipboard   = True
 
 Set objIE    = Nothing
End Function



View comments (2)

Available from 20th October, London, UK

Well, as projects come to completion, my time with my current client comes to an end on 17th April. From that date, I shall be on the open market so if you require a packager with extensive experience in WPS, IS, Orca/InstEdit, innumerable tools and utilities, Active Directory, Group Policy (both to scripting-interface level), look no further.

In addition to packaging, I have skills in VB, VBA, VB Script and ASP/HTML. I have developed my own tool-set in order to solve particular problems or to automate those mind-numbing tasks that fall to each of us from time to time. For example, I have a drag and drop-enabled script which takes an MSI, creates an Active Directory group, a Group Policy Object and a link to that GPO (with a selectable link order number), assigns the group and delegations to the GPO, adds the MSI (and any MST present) as a package and then creates the advertising scripts for the package.

VB tools include class-containing DLLs, e.g. a script-friendly interface to MSI.DLL, along with a Windows Explorer shell extension to enable the display of file version info, where present.

My ASP/HTML projects have included a workflow system for application packaging requests.

I am an extensive contributor here at IT Ninja, as well as at Symantec Connect and InstallSite.org, under the pseudonym VBScab. You are more than welcome to peruse my posts and gauge my competency in that way.

Lastly, although I prefer working in London/South East England, I am willing to travel for the right role.

Be the first to comment
Showing 1 - 3 of 3 results

Top Contributors

Talk About Kace K1000 Management Appliance