Greetings all,
I could use some assistance with getting this script to work. What I am trying to do is to pull the log from a remote workstation, and take that data and have it open into Notepad.
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Input Remote Device Name
strComputer = InputBox("Enter Name of the Remote Computer:","Prompt!")
'Make remote connection cimv2 namespace
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
'Run query to collect the single data file (radstate log)
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_DataFile Where Name = 'C$\\Program Files (x86)\\Hewlett-Packard\\HPCA\\Agent\\log\\radstate.log'")
'Declare variables
objFileName = "radstate"
objFileExtension = "log"
strFilePath = "\\" & strComputer & "\C$\Program Files (x86)\Hewlett-Packard\HPCA\Agent\log\" & _
objFileName & "." & objFileExtension
'Opens radstate log for reading
Set objTextFile = objFSO.OpenTextFile(strFilePath, ForReading)
strContents = objTextFile.ReadAll
Dim Wsh
Set Wsh = WScript.CreateObject("WScript.Shell")
Return = Wsh.Run("Notepad.exe", 1, strContents) ' Launch Notepad.
WScript.Sleep 800 ' Delay
objTextFile.Close
I'll look forward to a reply.
You guys are the best! Thanks,
Mike B.