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

Script to locate name in list and fill Answer yes or no.

$
0
0

I currently have a script that  finds a file on my computer (or any computer i run script on) then reports back to a file on a  network drive, this way all the computers on the domain can report back to same file. I plan on going a little bit further with so, I made another script that pulled all the computers from my active directory and loaded them into a csv. I want the script to report back to the CSV and find its computer name in the list and fill in the next column and basically write yes or no if the file existed.   The name of the computer without a doubt should be the same names that are in the CSV and the same name the script looks up at first.

here is my current script

(files i currently are looking up are just test files till I perfect the script)

Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
strFileName = "C:\Documents and Settings\sshell\Desktop\" & dt & strComputerName

Const ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists("C:\Documents and Settings\sshell\Desktop\lol.exe") Then
    objFSO.DeleteFile("C:\Documents and Settings\sshell\Desktop\lol.exe")
    Set objFile = objFSO.OpenTextFile("C:\Documents and Settings\sshell\Desktop\lol.txt", ForAppending)
    objFile.WriteLine(strComputerName) & "This Should find name in list and say if existed or not"
    objFile.Close

    Wscript.Quit

Else
    WScript.Echo "No file on: " & strComputerName
    Wscript.Quit
End If

Please help me out with this. I having hard time getting it right. There only one group of peeps I know helps me every time I look for help! The scripting guys!


Shawn Shell


Viewing all articles
Browse latest Browse all 15028

Trending Articles