VbScript to Query Users Desktops of a Certain Shortcut to a Folder or Share
Posted on 2011-10-24
I have a task to query multiple machines of a shortcut or folder on user's desktop that contains of the word "ABE Materials" . Can someone please help me tweak my script?
I have a list of workstations that I need to query to find out which ones have a folder that contains the word "ABC" on their desktop folder shortcuts (rather than a static variable use a wildcard) Example is to query ABC Folder or Folder ABC. Can someone please help me tweak the script below?
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("C:\DesktopsFinal.txt", ForReading)
Set objResultFile = objFSO.OpenTextFile("C:\CheckFolderResults.txt", ForWriting, True)
arrTextFile = Split(objTextFile.ReadAll, vbCrLf)
For i = 0 To UBound(arrTextFile)
strComputer = "\\" & arrTextFile(i)
If objFSO.FolderExists(strComputer & "\C$\ABC") Then
objResultFile.WriteLine "Folder found on " & strComputer
objResultFile.WriteLine "Folder not found on " & strComputer
WScript.Echo "All Done!"