Skip to content

Instantly share code, notes, and snippets.

@ricardojoserf
Created January 23, 2024 15:13
Show Gist options
  • Save ricardojoserf/6e1a242e77a52c78b630af22d5709153 to your computer and use it in GitHub Desktop.
Save ricardojoserf/6e1a242e77a52c78b630af22d5709153 to your computer and use it in GitHub Desktop.
Script to delete files generated to set persistence using Startup folder using the script: https://gist.github.com/ricardojoserf/d021310080ea34c8c6187d82065dde85
$Dir="C:\ProgramData\Outlook"
$ExeFile = "notmalicious.exe"
$VbsFile = "CheckUpdate.vbs"
$LnkFile = "Outlook.lnk"
$IcoFile = "microsoft-outlook.ico"
## Unhidden and delete files from Dir
cmd /c "dir /a $Dir"
attrib -h $Dir\$ExeFile
attrib -h $Dir\$VbsFile
attrib -h $Dir\$IcoFile
del $Dir\$ExeFile
del $Dir\$VbsFile
del $Dir\$IcoFile
cmd /c "dir /a $Dir"
## Delete .lnk
del "$($env:USERPROFILE)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\$LnkFile"
cmd /c "dir /a ""$($env:USERPROFILE)\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment