I've got a script that is currently using a WScript.Shell COM object to create a shortcut.
$shortcut = (New-Object -ComObject WScript.Shell).Createshortcut("$shortcutFolder\target.lnk")
Unfortunately, setting the target path of the shortcut...:
$shortcut.TargetPath = $targetPath
...is taking a very long time (30 to 75 seconds) if it has not been done previously in the current Powershell session. If, however, the command is run again, its time to execute is on the order of milliseconds as it should be.
Is there another, maybe native, way to accomplish this that will work better? Alternatively, is there anything I can do to speed this process up? I've got a Process Monitor trace, but I haven't been able to glean much from it.
$targetPathcontain?