Hi:
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.
[code=vb]
. Dim sTargets
. Dim sFileNames
. Set oWMI = GetObject("winm gmts:\\.\root\c imv2")
. set SCs = oWMI.InstancesO f("Win32_Shortc utFile")
. 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
[/code]
This code works - but will not find anything in the users desktop, only in the all users desktop.
Des
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.
[code=vb]
. Dim sTargets
. Dim sFileNames
. Set oWMI = GetObject("winm gmts:\\.\root\c imv2")
. set SCs = oWMI.InstancesO f("Win32_Shortc utFile")
. 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
[/code]
This code works - but will not find anything in the users desktop, only in the all users desktop.
Des
Comment