Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

shortcut creation not working

$
0
0

I thought this may be due to our McAfee virus scans but even after I uninstalled McAfee from a Windows 7 machines I still can't create shortcuts with PowerShell.  I have this code.   Yes, _Productivity Applications does exist and I have full rights to the TargetPath server.   (I can manually create this shortcut, but this script fails)

 

$shell=New-Object-ComObjectWScript.Shell
$Location="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\_Productivity Applications"
$shortcut=$shell.CreateShortcut("$Location\EP Evaluator 11.lnk")
$shortcut.TargetPath="\\SR01SV0D0\d$\EE11\ee11.exe"
$shortcut.IconLocation="\\SR01SV0D0\d$\EE11\ee11.exe"
$shortcut.Save()

The error I keep getting is this:

Exception calling "Save" with "0" argument(s): "Unable to save shortcut "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\_Productivity Applications\EP
Evaluator 11.lnk"."

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles