We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

MrMann
Posts: 3
Joined: Fri Feb 24, 2017 12:19 pm

Set APPDIR from Powershell

Hi,
We're running AI 12.8 and I'm trying to set the APPDIR from a value that's in the registry. I've tried using the search facility in AI, but it doesn't seem to quite work in my case.

Our main software can run either x86 or x64, so I need to search HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\<Company>\<Product>\data_dir and HKEY_LOCAL_MACHINE\SOFTWARE\<Company>\<Product>\data_dir for a value.

I can get it to work in Powershell, using these two single commands:
(Get-ItemProperty -Path HKLM:\SOFTWARE\Wow6432Node\Oracle\Database\11).data_dir
(Get-ItemProperty -Path HKLM:\SOFTWARE\Oracle\Database\11).data_dir

However, does anyone know how I can do the following:
[1] Set the APPDIR if the first command returns a value
[2] If the first fails, set the APPDIR using the second command returned value

Any ideas would be appreciated!
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Set APPDIR from Powershell

Hello and welcome to Advanced Installer forums,

To set the APPDIR in a powershell custom action, please take a look on the Get and set a property in Windows PowerShell Script custom action article.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
MrMann
Posts: 3
Joined: Fri Feb 24, 2017 12:19 pm

Re: Set APPDIR from Powershell

Hi Dan,
Thanks for your response - I have come across this page already, but I must admit it didn't really help me that much. I've tried running the following, but it seems to error when running:
// getting a property
$APPDIR = (Get-ItemProperty -Path HKLM:\SOFTWARE\Oracle\Database\11).data_dir
MrMann
Posts: 3
Joined: Fri Feb 24, 2017 12:19 pm

Re: Set APPDIR from Powershell

I've managed to get this set now using:
AI_SetMsiProperty APPDIR (Get-ItemProperty -Path HKLM:\SOFTWARE\wow6432Node\oracle\database\11).data_dir

What I need to do now, is figure out how to query the x64 area, if the x32 area is not present.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Set APPDIR from Powershell

Hello,

Note that the installer sets the VersionNT64 property to the version number for the operating system only if the system is running on a 64-bit computer. The property is undefined if the operating system is not 64-bit. For details, please take a look on the Example of using VersionNT & VersionNT64 properties article.

Should there be any difficulty you encounter implementing something, please do not hesitate to contact me and I will gladly assist.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”