Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Shortcuts = Get-ChildItem -Recurse "C:\" -Include *.lnk
- $Shell = New-Object -ComObject WScript.Shell
- foreach ($Shortcut in $Shortcuts)
- {
- $Properties = @{
- ShortcutName = $Shortcut.Name
- Path = $Shortcut.FullName
- ShortcutDirectory = $Shortcut.DirectoryName
- Target = $Shell.CreateShortcut($Shortcut).targetpath
- }
- New-Object PSObject -Property $Properties
- if (-not (Test-Path $Properties.Target)) {Remove-Item $Properties.Path -Force -ErrorAction 0}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement