Author Topic: Add RegKeys After Install  (Read 361 times)

Offline joeOPD

  • Newbie
  • *
  • Posts: 21
    • View Profile
Add RegKeys After Install
« on: November 19, 2021, 02:34:03 PM »
What is the best way to add registry keys after install? We want to install PDF24 but add a bunch of regkeys after the fact

MSI Flags

pdf24-creator.msi AUTOUPDATE=No DESKTOPICONS=Yes FAXPRINTER=No REGISTERREADER=No /qn

Reg Key

[HKEY_LOCAL_MACHINE\SOFTWARE\PDF24]
"NoEmbeddedBrowser"=dword:00000001
"NoFax"=dword:00000001
"NoMail"=dword:00000001
"NoOnlineConverter"=dword:00000001
"NoOnlinePdfTools"=dword:00000001
"NoPDF24MailInterface"=dword:00000001
"NoReader"=dword:00000001
"NoUpdateCheckBtns"=dword:00000001

[HKEY_CURRENT_USER\SOFTWARE\PDF24]
"NoEmbeddedBrowser"=dword:00000001
"NoFax"=dword:00000001
"NoMail"=dword:00000001
"NoOnlineConverter"=dword:00000001
"NoOnlinePdfTools"=dword:00000001
"NoPDF24MailInterface"=dword:00000001
"NoReader"=dword:00000001
"NoUpdateCheckBtns"=dword:00000001

Offline Andrew Jimenez

  • Patch My PC - Support Engineer
  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Add RegKeys After Install
« Reply #1 on: November 19, 2021, 02:38:00 PM »
I would use a post install script. You can easily turn a registry file into a PowerShell script using this awesome tool: https://reg2ps.azurewebsites.net/

Offline joeOPD

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Add RegKeys After Install
« Reply #2 on: November 26, 2021, 08:08:38 AM »
I would use a post install script. You can easily turn a registry file into a PowerShell script using this awesome tool: https://reg2ps.azurewebsites.net/

Does the form matter.  I used that tool but it didn't cover certain use cases.  This has some uncaught errors but when it runs out of the PS ISE it works great.  However, they aren't caught in a try catch

Code: [Select]
New-Item -Path 'HKLM:\SOFTWARE\' -Name 'PDF24'
New-Item -Path 'HKCU:\SOFTWARE\' -Name 'PDF24'
Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoEmbeddedBrowser' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoFax' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoMail' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoOnlineConverter' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoOnlinePdfTools' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoPDF24MailInterface' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoReader' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'Fart' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoTrayIcon' -type 'dword' 1
Set-ItemProperty -LiteralPath 'HKLM:\SOFTWARE\PDF24' -Name 'NoUpdateCheckBtns' -type 'dword' 1
Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoEmbeddedBrowser' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoFax' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoMail' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoOnlineConverter' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoOnlinePdfTools' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoPDF24MailInterface' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoReader' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'Fart' -type 'dword' 1
Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoTrayIcon' -type 'dword' 1
    Set-ItemProperty -LiteralPath 'HKCU:\SOFTWARE\PDF24' -Name 'NoUpdateCheckBtns' -type 'dword' 1
    return $true

Offline Andrew Jimenez

  • Patch My PC - Support Engineer
  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Add RegKeys After Install
« Reply #3 on: November 29, 2021, 09:21:21 AM »
You can definitely add in a try catch, the biggest thing is to ensure is that it returns a 0 if it is successful, or the entire installation might return as failed.