You are not processing $officeShortcuts correctly. Try the script below. Note that I do not have Office installed to be able to fully test this.
$wshShell = New-Object -ComObject WScript.Shell
$userProfiles = @()
$officeShortcuts = @()
$officeShortcutNames = @("Word", "Outlook", "Excel", "PowerPoint", "Publisher", "Access", "OneNote", "Visio", "Project")
$userProfiles = Get-ChildItem -Exclude "lsweeper" "C:\Users"
foreach ($profile in $userProfiles) {
#Build required user profile paths
$requiredPaths = @("$profile\Desktop", "$profile\OneDrive - Tideworks Technology\Desktop", "$profile\AppData\Roaming\Microsoft\Windows\Start Menu\Programs")
foreach ($path in $requiredPaths) {
#Find existing Office shortcuts
if (Test-Path $path) {
#The path exists
$officeShortcuts += Get-ChildItem -Path $path -Filter "*.lnk" | Where-Object { $_.BaseName -in $officeShortcutNames }
}
}
}
foreach ($sc in $officeShortcuts) { # $officeShortcuts contains file objects
#Inspect each shortcut (target path)
"Processing {0}" -f $sc.FullName
remove-item -path $sc.FullName # delete existing shortcut
$AppName = $sc.basename # get the name ex: Word
$newsc = $WshShell.CreateShortcut($sc.fullname)
$NewPath = "C:\Program Files\Microsoft Office\root\Office16\" + $AppName + ".exe"
"Setting it to execute {0}" -f $NewPath
$newsc.TargetPath = $NewPath
$newsc.Save()
}