mgeeky-Penetration-Testing-.../red-teaming/Create-Lnk.ps1

24 lines
496 B
PowerShell
Raw Permalink Normal View History

2020-08-04 19:07:30 +02:00
param (
[Parameter(Mandatory=$true)]
[string]
$TargetPath,
[Parameter(Mandatory=$true)]
[string]
$OutputLnk,
[Parameter(Mandatory=$false)]
[string]
$Arguments = "",
[Parameter(Mandatory=$false)]
[string]
$WorkingDirectory = ""
)
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($OutputLnk)
$Shortcut.TargetPath = $TargetPath
$Shortcut.Arguments = $Arguments
$Shortcut.WorkingDirectory = $WorkingDirectory
$Shortcut.Save()