Public/Remove-DesktopShortcutPublic.ps1

function Remove-DesktopShortcutPublic
{
    <#
        .DESCRIPTION
            Delete a shortcut from Users\Public\Desktop
 
        .PARAMETER Name
            The name of the shortcut to search for
 
        .EXAMPLE
            Remove-DesktopShortcutPublic -Name "Google Chrome.lnk"
 
        .NOTES
            Created by: Jon Anderson
            Modified: 2023-07-10
 
    #>

    param(
        [parameter(Mandatory = $true)][ValidateNotNullOrEmpty()]
        [String]$ShortcutName
    )

    $ShortcutPath = "$ENV:PUBLIC\Desktop"
    if(Test-Path "$($ShortCutPath)\$($ShortcutName)")
    {
        Write-LogEntry -Value "Attempting to remove $ShortcutPath\$ShortcutName" -Severity 1
        $Error.Clear()
        try
        {
            Remove-Item -Path "$($ShortCutPath)\$($ShortcutName)" -Force -ErrorAction Stop
        }
        catch
        {
            Write-LogEntry -Value "Failed to remove $($ShortCutPath)\$($ShortcutName)`n$($PSItem.Exception.Message)" -Severity 3
            return
        }
        if(!($Error))
        {
            Write-LogEntry -Value "Successfully removed $($ShortCutPath)\$($ShortcutName)" -Severity 1
            return
        }        
    }
    Write-LogEntry -Value "Unable to find $($ShortCutPath)\$($ShortcutName)" -Severity 2
}