sirbounty
asked on
Programmatically change Icon for desktop shortcut...
First of all - is this possible? I know it can be done, but can it be done for each profile if the change is applied to say All Users\Desktop\Shortcut.lnk ?
Secondly - any guidance on this. We're using a product called Netbackup and the default shortcut placed on the desktop points to an invalid icon - I'd like to correct this, but across 90+ servers, I'd rather script a solution...
WSH/WMI/VBS preferred
Secondly - any guidance on this. We're using a product called Netbackup and the default shortcut placed on the desktop points to an invalid icon - I'd like to correct this, but across 90+ servers, I'd rather script a solution...
WSH/WMI/VBS preferred
ASKER
Any way to have this loop through a list of servers?
Or maybe I can just deploy it locally - I already have code to do that...let me test this...thanx.
Or maybe I can just deploy it locally - I already have code to do that...let me test this...thanx.
ASKER
Using this - I get "unable to save shortcut". Here's the code:
dim strIcon, strPath
dim oShell, oCut
strIcon="E:\VERITAS\NetBac kup\bin\nb console.ex e, 0"
strPath="%AllUsersProfile% \Desktop\N etBackup Administration Consol (E).lnk"
Set oShell = Wscript.CreateObject("Wscr ipt.Shell" )
Set oCut = oShell.CreateShortcut(strP ath)
oCut.IconLocation = strIcon
oCut.Save
Set oCut=Nothing
Set oShell=Nothing
dim strIcon, strPath
dim oShell, oCut
strIcon="E:\VERITAS\NetBac
strPath="%AllUsersProfile%
Set oShell = Wscript.CreateObject("Wscr
Set oCut = oShell.CreateShortcut(strP
oCut.IconLocation = strIcon
oCut.Save
Set oCut=Nothing
Set oShell=Nothing
ASKER
I've also tried using a dll that contains about 7 different icons - still no go... :(
Any ideas?
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
My apologies; I confused my operators.
This line above:
if oFile.attributes & 1 then oFile.attributes = oFile.attributes - 1
should read:
if oFile.attributes and 1 then oFile.attributes = oFile.attributes - 1
This line above:
if oFile.attributes & 1 then oFile.attributes = oFile.attributes - 1
should read:
if oFile.attributes and 1 then oFile.attributes = oFile.attributes - 1
ASKER
Part of the problem may have been I'm running this from E: and AllUsersProfile is on C:...
But thanx - it works! :^)
But thanx - it works! :^)
dim strIcon, strCutPath, oShell, oCut
strIcon = "notepad.exe, 0" ' the correct icon as specified by file name, position in the file
strCutPath = "c:\document & settings\all users\desktop\shorcut.lnk"
set oShell = WScript.CreateObject("WScr
set oCut = WShell.CreateShortcut(strC
oCut.IconLocation = strIcon
oCut.Save