Hi.
I am trying to write a VBS Script to find a value in the registry for Windows XP and Windows 7 machines. Depending upon what value is found I want it to write to a text file "ComputerName and Correct, Incorrect" this text file will be located on a Shared folder where everyone will have access to.
Example of what I would like in the text file:
Workstation1 -Error not found
Workstation2 -Correct
Workstation3 -Correct
This code below is not working for me,
I am trying to write a VBS Script to find a value in the registry for Windows XP and Windows 7 machines. Depending upon what value is found I want it to write to a text file "ComputerName and Correct, Incorrect" this text file will be located on a Shared folder where everyone will have access to.
Example of what I would like in the text file:
Workstation1 -Error not found
Workstation2 -Correct
Workstation3 -Correct
This code below is not working for me,
Code:
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Dim objNetwork : Set objNetwork = CreateObject("WScript.Network")
Dim strComputerName : strComputerName = objNetwork.ComputerName
Dim strAUOptions, strRegPath, objFile, strFile, objFSO
Const ForWriting = 1
Const FORAPPENDING = 8
Const OpenAsASCII = 0
Const CreateIfNotExist = True
strRegPath = "SOFTWARE\Policies\Microsoft\Windows\SystemCertificates\Root\Certificates\FA67045DEDAE62811C7DA27"
'strFA67045DEDAE62811C7DA27 = "Blob"
strFile = "C:\output.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFile,FORAPPENDING,True)
Set objShell = CreateObject("WScript.Shell")
On Error Resume Next
Err Clear
VALUE=objShell.RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\SystemCertificates\Root\Certificates\FA67045DEDAE62811C7DA27")
if VALUE = "FA67045DEDAE62811C7DA27" then
objFile.WriteLine("***Correct*** " & objNetwork.ComputerName & " - Certificate is Correct" & VALUE & ")")
end if
If NOT ("FA67045DEDAE62811C7DA27") then
objFile.WriteLine (objNetwork.ComputerName & " - Certificate is Incorrect")
end if
if IsNull(VALUE) then
objFile.WriteLine (objNetwork.ComputerName & " - Certificate does not exist??!")
end if
objFile.Close
WScript.Quit