This topic contains 1 reply, has 2 voices, and was last updated by
November 9, 2015 at 7:51 am #31801ParticipantPoints: 0Rank: Member
I am using this script to create a shortcut for IE:
$TargetFile = "$env:ProgramFiles\Internet Explorer\iexplore.exe" $ShortcutFile = "$env:Programdata\Microsoft\Windows\Start Menu\Programs\Internet Explorer.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.TargetPath = $TargetFile $Shortcut.Description = "Finds and displays information and Web sites on the Internet." $Shortcut.WorkingDirectory = "%HOMEDRIVE%%HOMEPATH%" $Shortcut.Save()
The code works fine and creates the shortcut, but if this shortcut is pinned to the taskbar via the "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\TBDEn" /v SBOEM0" reg key, IE instances do not stack. What I mean by that is if you click on the icon on the taskbar, a new icon on the taskbar appears with the open window along with the pinned item so there are now to IE icons side by side until I close IE. When I copy the actual link file instead of creating it, it exhibits normal expected behavior ( i.e all open programs stack in the taskbar).
I noticed that the icon created via powershell is a little smaller in size than the one auto created by windows.
Is there a way to view all the ComObject properties of an existing WScript.Shell object in powershell so that I can copy the missing attributes?
November 13, 2015 at 11:44 am #31938KeymasterPoints: 1Rank: Member
Viewing COM object properties requires them to have a type library (TLB) file registered on the system – COM doesn't support self-discovery ("reflection") like .NET does. What you're using is a very old and deprecated interface, so it's not surprising that it doesn't work well against newer versions of Windows. I'm not sure I have a better solution for you, but I'll dig around and post again if I find something!
The topic ‘Advanced shortcut creation’ is closed to new replies.