Find and Delete a shortcut for all users

Comments

2 comments

  • Josh Mackelprang

    Hey Geoff,

    A quick foreach loop in PowerShell should take care of this,

    $files = Get-ChildItem C:\Users\*\Desktop\your_shortcut.lnk
    
    foreach ($file in $files)
    {
        Remove-Item $file -Force -WhatIf
    }
    

    You can run that on a target machine manually first to verify its doing what you would like. if it is, go ahead and remove the -WhatIF and you can run it as a PDQ Inventory Tool, or a PowerShell step in PDQ Deploy.

    -Josh

    0
    Comment actions Permalink
  • Geoff Revell

    Worked like a charm. Thank you so much Josh.

    0
    Comment actions Permalink

Please sign in to leave a comment.