Adding Registry from command line - Advanced Installer Community
Dorababu
Posts: 25
Joined: Fri Jun 16, 2017 8:37 am

Adding Registry from command line

I would like to add a registry to HKLM/Software/WOW6432Node so that it should like as follows

MySoftware
Database

and the registry name and data should be Connectionstring and some value

I want to achieve this using command line
Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Adding Registry from command line

Hello,

This could be achieved using the following Command Syntax

Code: Select all

/NewReg  { [-RegKey <registry_key>] | [-RegValue <registry_value_name>] } 
         [-Data <registry_data>] [-64bit]
Please take a look on our article : Registry Commands

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dorababu
Posts: 25
Joined: Fri Jun 16, 2017 8:37 am

Re: Adding Registry from command line

I have gone through and I tried the following but no luck can some one give me a working one

Code: Select all

$RegistryParams = "/edit $aippath /NewReg -RegKey HKLM\Software\MyAPP\MYREG -data tesdata"
Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Adding Registry from command line

Hello,

I have successfuly tested this powershell command:

Code: Select all

.\advancedinstaller.com /edit "C:\Program Files (x86)\Caphyon\Advanced Installer 14.0.2\bin\x86\aip.aip" /newreg -regkey HKLM\Software\MyAPP\MYREG -data tesdata
Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Dorababu
Posts: 25
Joined: Fri Jun 16, 2017 8:37 am

Re: Adding Registry from command line

Here is the code I tried but I am still getting default registry

Code: Select all

$InstallerName = "Installer1.2.10"
$SourceDir = "D:\AdvanceInstaller"
$AdvanceInstallerPath = Get-ChildItem "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" |  ForEach-Object {Get-ItemProperty $_.PSPath} | Where-Object {$_.DisplayName -match "Advanced Installer"}
$InstallerPath= "$($AdvanceInstallerPath.InstallLocation)bin\x86\AdvancedInstaller.com"
$aippath = "$SourceDir\$($InstallerName).aip"
$ProductName = "MyApplication"


$ProductParams = "/edit $aippath /SetProperty ProductName=$ProductName"
$repository = "/edit $aippath /SetAppdir -buildname DefaultBuild -path C:\MyApplication"
$newParameters = "/newproject $aippath -type enterprise"
$buildParams = "/build $aippath" 

Start-Process -FilePath $InstallerPath -ArgumentList $newParameters -Wait -WindowStyle Hidden -ErrorAction Stop
Start-Process -FilePath $InstallerPath -ArgumentList $ProductParams -Wait -WindowStyle Hidden -ErrorAction Stop
Start-Process -FilePath $InstallerPath -ArgumentList $repository -Wait -WindowStyle Hidden -ErrorAction Stop
#Start-Process -FilePath $InstallerPath -ArgumentList $registryParams -Wait -WindowStyle Hidden -ErrorAction Stop

$registryParams ="/edit $aippath /NewReg -regkey HKLM\Software\MyApplication -data tesdata"
Start-Process -FilePath $InstallerPath -ArgumentList $registryParams -Wait -WindowStyle Hidden -ErrorAction Stop
Start-Process -FilePath $InstallerPath -ArgumentList $buildParams -Wait -WindowStyle Hidden -ErrorAction Stop
Dorababu
Posts: 25
Joined: Fri Jun 16, 2017 8:37 am

Re: Adding Registry from command line

Also how can I set Company name from command line?
Dorababu
Posts: 25
Joined: Fri Jun 16, 2017 8:37 am

Re: Adding Registry from command line

Seems like the default it is taking, how can we point to Target computer?
Registry
Registry
reg.PNG (9.06 KiB) Viewed 6999 times
Dorababu
Posts: 25
Joined: Fri Jun 16, 2017 8:37 am

Re: Adding Registry from command line

After all I got this code

Code: Select all

$InstallerName = "Installer1.2.10"
$SourceDir = "D:\AdvanceInstaller"
$AdvanceInstallerPath = Get-ChildItem "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall" |  ForEach-Object {Get-ItemProperty $_.PSPath} | Where-Object {$_.DisplayName -match "Advanced Installer"}
$InstallerPath= "$($AdvanceInstallerPath.InstallLocation)bin\x86\AdvancedInstaller.com"
$aippath = "$SourceDir\$($InstallerName).aip"
$ProductName = "MyApplication"

$DeleteReg = "/edit $aippath /DelReg -regkey HKUD\Software\[Manufacturer]"
Start-Process -FilePath $InstallerPath -ArgumentList $DeleteReg -Wait -WindowStyle Hidden -ErrorAction Stop
$registryParams = "/edit $aippath /NewReg -RegKey HKUD\Software\MyApplication -data ''"
$registryParams1 = "/edit $aippath /NewReg -RegValue HKUD\Software\MyApplication\path -data C:\MyApplication"
Start-Process -FilePath $InstallerPath -ArgumentList $registryParams -Wait -WindowStyle Hidden -ErrorAction Stop
Start-Process -FilePath $InstallerPath -ArgumentList $registryParams1 -Wait -WindowStyle Hidden -ErrorAction Stop
Sorin
Posts: 663
Joined: Mon May 08, 2017 1:03 pm

Re: Adding Registry from command line

Hello,
Also how can I set Company name from command line?
You could set the "Manufacturer" property using the following command line:

Code: Select all

AdvancedInstaller.com /edit "C:\Users\Sorin\Desktop\Work\Forum\Dorababu\Adding Registry from command line\Your Application.aip" /setproperty Manufacturer="aaa"
After all I got this code
I'm glad that you've figured it out.

Best regards,
Sorin
Sorin Stefan - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”