Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

VBS trying to find a link on users desktops on a list of computers in my network

$
0
0

Ok, I provide a list of computers in a text file to the code. 

The code searches all users on each computer and determines if a file exists or not.  If it exists it records the computer/user name as says the link is found.  If not it records the computer/user name and says none.

I need the code to work on Windows 7 and Windows XP.  I am not a programmer at all so I am struggling with this.

My code is below...................

InputFile ="computers.txt"
Const DeleteReadOnly =True
Const ForAppending =8

Dim goFS  :Set goFS = CreateObject("Scripting.FileSystemObject")
Dim gsLog : gsLog    =".\logdemo.log"
WScript
.Echo gsLog,"exists:",CStr(goFS.FileExists(gsLog))
'                           .OpenTextFile(filename[, iomode[, create[, format]]])
Dim goLog :Set goLog= goFS.OpenTextFile(gsLog, ForAppending,True)
goLog
.WriteLine Now &" start"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(InputFile)
DoWhileNot(objFile.AtEndOfStream)
strComputer
= objFile.ReadLine
ForEach objsubfolder In objFSO.GetFolder("\\"& strComputer &"%HOMEPATH%").subfolders

If objFSO.FileExists(objsubfolder.Path&"\desktop\program1.LNK")Then
golog
.WriteLine Join(Array(Now, strComputer, objsubfolder,"This Computer has Program 1"))

Else

golog
.WriteLine Join(Array(Now, strComputer, objsubfolder,"None"))

EndIf
Next
Loop

golog
.WriteLine Now &" End"
golog
.WriteLine "-----------------------------------------------------------"
golog
.Close

MsgBox
"Done"


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>