title: Powershell replacing shortcut target
body: <p>can someone please check this script and point me to the right direction. I'm not getting any errors though but script is not working as expected. I'm trying to achieve a shortcut target changed based on logged user.My powershell skills are basic and i'm sure must be missing some logic here:- </p>
  
  <pre><code>#$shell = new-object -com wscript.shell
  $loguser="username"
  $link ="test1.lnk"
  $oldtarget=$link.tragetpath 
  $oldpath="c:\notepad.exe"
  Get-ChildItem  -Filter $link -Recurse
  if ($oldtarget -eq $oldpath)
  {
  $csvfile=Import-csv "c:\test.csv"
  $newtarget=$row.newpath
  $user=$row.user
  (get-Content $csvfile) | foreach-object {$_.$user -match $loguser} | -replace        $oldtarget $newtarget
  }
  $link.SaveInfo
  </code></pre>