[wix-users] EXT: Re: Custom action having difficulty writing to registry

Edwin Castro egcastr at gmail.com
Tue May 5 14:47:39 PDT 2020


Have you opened your msi in a table editor like Orca or InstEdit and
checked your Component table to ensure your components are marked as 64bit?

You are not using an absolute path to start powershell. Are you sure you
are using a 64bit powershell.exe?

The RegistrySearch at
http://0ptikghost.blogspot.com/2011/03/executing-powershell-scripts-silently.html
to
find powershell.exe likely still works.

There is also a CAQuietExec64 that you might want to use, especially if
your components are already attributed as 64bit.

--
Edwin G. Castro

On Tue, May 5, 2020 at 10:59 AM Griesshammer, Christoph (GE Healthcare) <
christoph.griesshammer at ge.com> wrote:

> Thank you for your response.
>
>
>
> We only build a 64-bit version of our installer.
>
>
>
> Here’s my registry component:
>
>
>
> <Component Id="RegVersionInfo" Guid="*" Permanent="no">
>
>                 <RegistryKey Root="HKLM" Key="SOFTWARE\Company\Product">
>
>                                 <RegistryValue Action="write"
> KeyPath="yes" Name="Location" Type="string" Value="[INSTALLFOLDER]"/>
>
>                                 <RegistryValue Action="write"
> Name="Version" Type="string"
> Value="[PRODUCT_MAJOR_VERSION].[PRODUCT_MINOR_VERSION].[PRODUCT_UPDATE_VERSION]"/>
>
>                 </RegistryKey>
>
> </Component>
>
>
>
> A file named Test.ps1 is delivered by the installer on disk.
>
>
>
> I have the following custom actions to then call Test.ps1:
>
>
>
> <CustomAction Id="CallTestPowerShell_cmd"             Property="
> CallTestPowerShell"             Execute="immediate" Value='"Powershell.exe"
> -NonInteractive -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass
> -NoLogo -InputFormat None -File "C:\Scripts\Test.ps1" ' />
>
>
>
> <CustomAction Id="CallTestPowerShell" BinaryKey="WixCA"
> DllEntry="CAQuietExec" Execute="deferred" Return="check" Impersonate="yes"
> />
>
>
>
> Scheduled as so:
>
>
>
> <Custom Action="CallTestPowerShell_cmd"             After="CostFinalize" />
>
> <Custom Action="CallTestPowerShell"
> Before="InstallFinalize"                  >(NOT Installed AND NOT REMOVE)
> OR (MAINT_BUTTON_PRESSED = 2)</Custom>
>
>
>
> Test.ps1 is failing on the following command:
>
>
>
> Set-ItemProperty -Path “HKLM:\SOFTWARE\Company\Product” -Name “Name”
> -Value “Value” -ErrorAction Stop
>
>
>
> And the error that I get is that the path for Set-ItemProperty does not
> exist.
>
>
>
> Hope that helps a bit?
>
>
>
> Christoph
>
>
>
> *From:* Edwin Castro <egcastr at gmail.com>
> *Sent:* Tuesday, May 5, 2020 1:38 PM
> *To:* WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
> *Cc:* Griesshammer, Christoph (GE Healthcare) <
> christoph.griesshammer at ge.com>
> *Subject:* EXT: Re: [wix-users] Custom action having difficulty writing
> to registry
>
>
>
> Perhaps there's a bitness mismatch between what you expect and reality?
>
> How are you locating powershell.exe?
>
>
>
> Actually, can you show us all your authoring related to this powershell
> script? How is it installed? How is it run?
>
>
>
> --
>
> Edwin G. Castro
>
>
>
>
>
> On Mon, May 4, 2020 at 6:46 PM Griesshammer, Christoph (GE Healthcare) via
> wix-users <wix-users at lists.wixtoolset.org> wrote:
>
> Hey everyone,
>
> I am hoping someone can help me understand why my custom action is having
> difficulties writing to the registry. I KNOW there are built in tools to
> write registry entries, however, we have a PowerShell script file that is
> delivered by the installer, and we then run this as a custom action. The
> PowerShell script also has to run in other scenarios, so it really can't be
> integrated into the installer other than a custom action that runs the
> script directly.
>
> The PowerShell script tries to write to the registry at HKLM:\Software\...
>
> I know our installer creates the registry key appropriately because it was
> always working, but now this new script fails with an error indicating the
> key is invalid.
>
> My custom action is deferred with impersonate set to no, and it is
> scheduled between InstallInitialize and InstallFinalize.
>
> Also, related, we saw a similar issue with accessing files from these
> scripts that were down in C:\Windows\System32\.
>
> Are these blocked locations or something? I've read about some virtual
> registry or something in older versions of Windows used by installers?
>
> Thank you for your time!
>
> Christoph Griesshammer
> Senior Software Engineer
> GE Healthcare Digital
>
>
> ____________________________________________________________________
> WiX Toolset Users Mailing List provided by FireGiant
> http://www.firegiant.com/
>
>



More information about the wix-users mailing list