For a reason I won't go in to here I recently had to create a fake program in the programs and features list of a computer. One example when this might be useful is for indexing purposes but there are other usecases for it as well.
Since this list is saved in the registry adding a new program to it is easy. I tend to follow the "code should document itself" approach since I never know who might have to modify my code at a later date, to that end I decided to make a function out of this instead of adding a lot of stuff to the registry inside the main script.
If you find another usecase for this script I would be happy to hear it.

Function New-PopsFakeProgram { <# .SYNOPSIS Add a fake program to programs & features .DESCRIPTION Add a fake program to programs & features .PARAMETER Name The internal name .PARAMETER DisplayName The name that should be shown .PARAMETER Publisher The name of the publisher .PARAMETER DisplayVersion The version number .PARAMETER DisplayIcon Path to a display icon, can be an exe file .PARAMETER UninstallString The string for uninstalling the program .PARAMETER NoRemove Remove Uninstall option in appwiz .PARAMETER NoModify Remove Modify option in appwiz .EXAMPLE New-PopsFakeProgram -Name "MyFakeProgram" -DisplayName "My fake program" .NOTES .LINK scriptingnerd.com/2020/03/13/use-powershell-to-create-a-fake-program-in-the-programs-and-features-list-for-indexing-purposes #> Param( [Parameter(Mandatory = $true)] [ValidateNotNullorEmpty()] [string]$Name, [Parameter(Mandatory = $true)] [ValidateNotNullorEmpty()] [string]$DisplayName, [Parameter(Mandatory = $false)] [ValidateNotNullorEmpty()] [string]$Publisher = "Dummy", [Parameter(Mandatory = $false)] [ValidateNotNullorEmpty()] [string]$DisplayVersion = $(Get-Date -Format "yyyy.dd.MM.HHmm"), [Parameter(Mandatory = $false)] [ValidateNotNullorEmpty()] [string]$DisplayIcon = "C:\Windows\explorer.exe", [Parameter(Mandatory = $false)] [ValidateNotNullorEmpty()] [string]$UninstallString = "DummyUninstall", [Parameter(Mandatory = $false)] [ValidateNotNullorEmpty()] [switch]$NoRemove, [Parameter(Mandatory = $false)] [ValidateNotNullorEmpty()] [switch]$NoModify ) if ( -not (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -PathType Container) ) { New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" -Name $Name | Out-Null } New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Name "DisplayName" -Type String -Value $DisplayName -Force | Out-Null New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Name "Publisher" -Type String -Value $Publisher -Force | Out-Null New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Name "DisplayVersion" -Type String -Value $DisplayVersion -Force | Out-Null New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Name "DisplayIcon" -Type String -Value $DisplayIcon -Force | Out-Null New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Name "UninstallString" -Type String -Value $UninstallString -Force | Out-Null If ($NoRemove) { New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Name "NoRemove" -Type Dword -Value 1 -Force | Out-Null } If ($NoModify) { New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Name "NoModify" -Type Dword -Value 1 -Force | Out-Null } }
Function Remove-PopsFakeProgram { <# .SYNOPSIS Remove a program from programs & features .DESCRIPTION Remove a program from programs & features .PARAMETER Name The internal name, this is probably not the one you see in programs & features .EXAMPLE Remove-PopsFakeProgram -Name "MyFakeProgram" .NOTES .LINK scriptingnerd.com/2020/03/13/use-powershell-to-create-a-fake-program-in-the-programs-and-features-list-for-indexing-purposes #> Param( [Parameter(Mandatory = $true)] [ValidateNotNullorEmpty()] [string]$Name ) if ( Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -PathType Container ) { Remove-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Name" -Recurse -Force } }