Non-working shortcut when created via Toec
-
I'm trying to create a shortcut via Toec with the following power shell lines. This works when ran on manually by running the power shell script on a test computer, but via Toec the behavior is different.
Toec creates the shortcut but when you double click it, it doesn't open at all.
$shell = New-Object -comObject WScript.Shell
$shortcut = $shell.CreateShortcut("C:\Users\Public\Desktop\Staff Shortcuts.lnk")
$shortcut.TargetPath = "\servername\DesktopShortcuts\Staff Shortcuts"Give the shortcut a specific icon, on this example the Star icon, # $shortcut.IconLocation = "shell32.dll,43"
$shortcut.IconLocation = "shell32.dll,43"
$shortcut.Save() -
I suspect that wscript.shell needs a user context instead of service.
-
@theopenem_admin said in Non-working shortcut when created via Toec:
I suspect that wscript.shell needs a user context instead of service.
I was able to get around it by using file copy to place the shortcut. Thanks for your time looking into it.
-
@theopenem_admin said in Non-working shortcut when created via Toec:
I suspect that wscript.shell needs a user context instead of service.
Interesting enough, the following works fine in Toec to create a Chrome shortcut pointing to a specific web site.
$shell = New-Object -comObject WScript.Shell
$shortcut = $shell.CreateShortcut("C:\Users\Public\Desktop\ETA Test Site - Chrome.lnk")
$shortcut.TargetPath = "C:\Program Files\Google\Chrome\Application\chrome.exe"
$shortcut.Arguments = "https://www.eta-i.org"
#$shortcut.WorkingDirectory = ""
$shortcut.Save()