• Welcome to Support Forum: Get Support for Patch My PC Products and Services.
 

Add RegKeys After Install

Started by joeOPD, November 19, 2021, 02:34:03 PM

Previous topic - Next topic

joeOPD

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

Andrew Jimenez (Patch My PC)

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/

joeOPD

Quote from: Andrew Jimenez 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/

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

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

Andrew Jimenez (Patch My PC)

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.