[wix-users] Registry search weirdness

John Naylor mejohnnaylor at mac.com
Mon Jul 4 20:11:52 PDT 2016


Hi Sampat - thanks for responding so quickly.

I’m running 64bit Windows 10, so I presume that the PS interactive shell, in which the script works well, is 64 bit also.

I’m creating a Windows Installer Package with burn for some library files, candle for my sources, & light to link the lot together. I don’t know how to tell whether the MSI is 32 or 64 bit. I’ll read the docs after hitting <send>

The custom action is deferred, not immediate

Here’s the code snippet I’m using to invoke the CA, my script is a file with Id=‘ServicesUtil’ defined elsewhere in the WXS file.

		<!-- Get Path to Powershell executable -->
		<Property Id='POWERSHELLEXE'>
			<RegistrySearch Id='POWERSHELLEXE'
				Type='raw'
				Root='HKLM'
				Key='SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell'
				Name='Path' 
			/>
		</Property>
		<Condition Message="This application requires Windows PowerShell.">
			<![CDATA[Installed OR POWERSHELLEXE]]>
		</Condition>

		<!-- Define command for Custom Action -->
		<SetProperty Id='SCStartServices'
			Before ='InstallFiles'
			Sequence='execute'
			Value =""[POWERSHELLEXE]" -Version 5.0 -NoProfile -NonInteractive -InputFormat None -ExecutionPolicy Bypass -Command "& '[#ServicesUtil]' ; exit $$($Error.Count)""
		 />		
		
		<!-- Define the Custom Action -->
		<CustomAction Id='SCStartServices'
			BinaryKey='WixCA'
			DllEntry='CAQuietExec'
			Return='check'
			Execute='deferred'
			Impersonate='no' 
		/>
		
		<!-- invoke custom action -->
		<InstallExecuteSequence>
			<Custom Action='SCStartServices' After='InstallFiles'><![CDATA[NOT Installed]]></Custom>
		</InstallExecuteSequence>

And here’s the error message from the install log:

CAQuietExec:  Get-ItemProperty : Cannot find path 'HKEY_LOCAL_MACHINE\SOFTWARE\Node.js' 
CAQuietExec:  because it does not exist.

> On Jul 4, 2016, at 9:18 PM, John Naylor <mejohnnaylor at mac.com> wrote:
> 
> I have a powershell script that installs and runs just fine. 
> 
> When I try to run it during the install as a custom action I get a failure message in the log, and the install rolls back. 
> 
> The problem line in the script is:
> 
> $myvar = Get-ItemProperty HKLM:SOFTWARE\path\to\property
> 
> The error in the log is that the item cannot be found. 
> 
> Running this line at the powershell prompt, or invoking the script its in produces the expected result. 
> 
> Does the installer prevent access to the registry during installation or something? I can't figure this one out. 
> 
> Thx!
> 
> Sent from my iPhone. Please excuse brevity and auto-corruptions. 
> 
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/




More information about the wix-users mailing list