Skip to content

Commit

Permalink
fix shortcut creation
Browse files Browse the repository at this point in the history
  • Loading branch information
mstrhakr committed Feb 11, 2024
1 parent 155f52a commit aaf8c26
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions scans.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,16 @@ if(!((Get-SmbShare).Name).toLower().Contains($shareName)){
}

# Create scan folder desktop shortcut
$shortcutPath = "C:\Users\Public\Desktop\Scans.lnk"
if ((Test-Path $shortcutPath -PathType Leaf) -and $shellObject.CreateShortcut($shortcutPath).TargetPath -eq $folderPath){
updateProgressBar "Creating Desktop Shortcut" 500
$shellObject = New-Object -ComObject ("WScript.Shell");
$desktopShortCut = $shellObject.CreateShortcut($shortcutPath);
$desktopShortCut.TargetPath = $folderPath;
$desktopShortCut.IconLocation = 'C:\ProgramData\scans.ico';
$desktopShortCut.Description = $description;
$desktopShortCut.Save() | Out-Null;
}
updateProgressBar "Creating Desktop Shortcut" 500;
$shortcutPath = "C:\Users\Public\Desktop\Scans.lnk";
$iconPath = 'C:\ProgramData\scans.ico';
$shellObject = New-Object -ComObject ("WScript.Shell");
$desktopShortCut = $shellObject.CreateShortcut($shortcutPath);
$desktopShortCut.TargetPath = $folderPath;
$desktopShortCut.IconLocation = $iconPath;
$desktopShortCut.Description = $description;
$desktopShortCut.Save() | Out-Null;



# Set network profile to Private if not domain joined.
Expand Down

0 comments on commit aaf8c26

Please sign in to comment.