I'm using the following script to find a shortcut with a specific string in it. In the code below the example is the word "font"
My problem is that this code looks everywhere EXCEPT the individual users desktop - it does find all of the shortcuts in All Users, but not in specific users.
I am executing the code AS the user whose desktop I need to search so there shouldn't be a security issue.
I have to write a small routine to add to an installer that will delete and old shortcut from the user desktop so I would really appreciate some help.
Expand|Select|Wrap|Line Numbers
- . Dim sTargets
- . Dim sFileNames
- . Set oWMI = GetObject("winmgmts:\\.\root\cimv2")
- . set SCs = oWMI.InstancesOf("Win32_ShortcutFile")
- . for each SC in SCs
- . If (InStr(1, SC.Target, "font", 1)> 0) Then
- . MsgBox "gotit"
- . sTargets = SC.Target
- . sFileNames = SC.Name
- . Exit For
- . End If
- .
- . Next
- . WScript.echo sTargets & vbcrlf & sFileNames
Des