Shortcut creation

I’m having some difficulty getting a fixlet created to push a .lnk shortcut for a website. What I’ve done is created a .lnk file on the bigfix server. Placed the .lnk in Program Files (x86)\BigFix Enterprise\BES Server\wwwrootbes\Uploads in a folder named with the sha1 value like all the other files. I then used the below code for my action script but when I test it I get a syntax error for the prefetch block. Any insight on why and how to resolve it would be greatly appreciated. Thank you.

begin prefetch block
add prefetch item name=cf6f22f2b8a42e5e3f9e2d0ef77b31b6d23a2901 sha1=cf6f22f2b8a42e5e3f9e2d0ef77b31b6d23a2901 size=2632 url=SWDProtocol://127.0.0.1:52311/Uploads/cf6f22f2b8a42e5e3f9e2d0ef77b31b6d23a2901/Workforce Timekeeping.lnk.bfswd sha256=ddaf9491fd0931604cfd6a5738786045e4951b5e4814083b1d0d270af0395d22
end prefetch block

parameter “baseFolder” = “C:\Users\Public\Desktop”

move “__Download/cf6f22f2b8a42e5e3f9e2d0ef77b31b6d23a2901” “{parameter “baseFolder”}Workforce Timekeeping.lnk”

waithidden cmd.exe /C cacls.exe “C:\Users\Public\Desktop\Workforce Timekeeping.lnk” /E /G Everyone:R

Assuming the filename is correct, you need to URL-encode the URL…which here means replacing the space in the filename with %20

1 Like

Yep I did miss that. Thank you!

New error though, failed to prefetch download. I’m not sure why… I did create the folder and place the .lnk into the folder myself and I didn’t use the bigfix console to upload it, would that have anything to do with it? Otherwise everything looks just about identical to another fixlet we’ve got that places .lnk files on the desktop.

Is Powershell an option in your environment?

You have several different options like most things with BigFix. I’ve had issues creating a lnk file on one machine and migrating it to another machine, so I prefer either creating it on the fly with Powershell or creating a URL file and placing it on the machine.

I had some examples i was trying to send but the forum is stripping off the code formatting and adding special quotes.

Something like this might work for you.

//create a shortcut for on the Public desktop
delete __createfile
delete createShortcut.ps1
createfile until @psEnd
[string]$shortcutPath = “C:\Users\Public\Desktop<Name of Shortcut>.lnk”
[string]$appPath = “”
[string]$arguments = “”
[string]$icon = “”
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut($shortcutPath)
$Shortcut.TargetPath = $apppath
if($arguments -ne “” -and $arguments -ne $null)
{
$Shortcut.Arguments = $arguments
}
if($icon -ne “” -and $icon -ne $null)
{
$Shortcut.IconLocation = $icon
}
$Shortcut.Save()
@psEnd
move __createfile createShortcut.ps1
waithidden ping localhost -n 10
waithidden cmd.exe /C powershell.exe set-executionPolicy remote
waithidden cmd.exe /C powershell.exe -file createShortcut.ps1
waithidden cmd.exe /C powershell.exe set-executionPolicy default

OR

// Enter your action script here
createfile until END2
[{{000214A0-0000-0000-C000-000000000047}]
Prop3=19,0
[InternetShortcut]
IDList=
IconIndex=0
URL=
IconFile=
END2
copy __createfile “c:\Users\Public\Desktop<URL NAME>.url”
dos cacls “c:\Users\Public\Desktop<URL NAME>.url” /e /t /g Users:R

1 Like

What error message are you getting on the prefetch - and is this in the Action Details of the Console, or in the client log?

Figured out my new error. It was the QnA app giving the error. The fixlet runs fine and installs the desired link. Unfortunately there was a difference in file location that was tripping things up. Easy fix.

Thank you all for the help

1 Like

Ah, makes sense.
In the Fixlet Debugger we can simulate the built-in actionscript commands like ‘download’ and ‘prefetch’, but would not be able to execute a download plug-in like ‘SWDProtocol’ without connecting to a real Bigfix deployment; nor could a Debugger download retrieve things from 127.0.0.1, that’s a download that only works when executed on the Root Server itself.

1 Like

Another reason why I like creating the shortcut on the fly because it’s easier to create and modify shortcuts dynamically and you can test it in debugger.

1 Like