eschloss
Posts: 616
Score: 25 Joined: 9/7/2004 From: Cincinnati Status: offline
|
I went about it a lsightly more dynamic way. I dropped Trace32.exe into \\SMSServer\Remote$. I create a pull down list of the log files on my machine with a sub at the top after Sub FillInCollections: Sub LogFileList Dim fso Set fso = CreateObject("scripting.filesystemobject") const HKEY_LOCAL_MACHINE = &H80000002 strComputer = "." Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\SMS\Client\Configuration\Client Properties" strValueName = "Local SMS Path" oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strLogPath = strValue & "logs" Set objFolder = fso.GetFolder(strLogPath) Set colFiles = objFolder.Files document.write("<Option Value=" & Chr(34) & "-1" & Chr(34) & " Select> Select a log file</Option>") For Each objFile In colFiles If InStr(objFile.Name, ".log") And InStr(objFile.Name, "-") = 0 Then document.write("<Option Value=" & Chr(34) & objFile.Name & Chr(34) & ">" & objFile.Name & "</Option>") End If Next End Sub I then add the following lines where I want the pull down list to show up: <TD width="416" height="1"> <P dir="ltr" style="MARGIN-RIGHT: 0px" align="left"> <span class="66CC99"><strong><font size="2">View a log file on the remote machine.</font></strong></span></P> <SELECT id="Select2" style="FONT-SIZE: 10pt" size="1" name="LogList"> <SCRIPT language="VBScript"> LogFileList() </SCRIPT></SELECT><p><SPAN class="blacktext"> <INPUT id="Button20" style="FONT-SIZE: 10pt" type="button" value="View Client Log" name="ViewLog"></SPAN></TD> <td width="416" height="1" colspan="3"> <P dir="ltr" style="MARGIN-RIGHT: 0px" align="left"><SPAN class="66CC99"><FONT size="1"> </P> </FONT></SPAN> </td> I then created a sub for the button click: Sub ViewLog_OnClick Set fso = CreateObject("scripting.filesystemobject") set WshShell = CreateObject("wscript.Shell") const HKEY_LOCAL_MACHINE = &H80000002 strComputer = document.frmMain.txtValue.value Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Microsoft\SMS\Client\Configuration\Client Properties" strValueName = "Local SMS Path" oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue strLogPath = "\\" & strComputer & "\" & Replace(strValue, ":", "$") & "logs\" i = document.frmMain.select2.selectedIndex LogFileName = document.frmMain.select2.options(i).Value if LogFileName = "-1" then return end if If fso.fileexists (strLogPath & LogFileName) then wshshell.Run "\\mcsmsmws1\remote$\trace32.exe " & strLogPath & LogFileName, 10, False Else msgbox "File " & LogFileName & " does not exist on " & strComputer & ".",,"Error" End If End Sub This approach filters out archived logs and allows for viewing of any of the log files in the folder without having to add them to the list manually.
|