myITforum.com Community Forum myITforum.com Community Forum

Home  Forums  Blogs  Live Support chat  Search Articles  Wiki  FAQ  Email Lists  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Photo Gallery  Member List  Search  Calendars  FAQ  Ticket List  Log Out

All Forums RSS Feed Subscription:


  


Open SMS Log files remotely with Ron Crumbakers SMS Remote Tools.

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
  Printable Version
All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003 >> Open SMS Log files remotely with Ron Crumbakers SMS Remote Tools. Page: [1]
Login
Message << Older Topic   Newer Topic >>
Open SMS Log files remotely with Ron Crumbakers SMS Rem... - 1/8/2007 11:19:05 AM   
xneilpetersonx

 

Posts: 157
Score: 1
Joined: 7/18/2006
Status: offline
I wanted a way to open up log files remotely using Ron Crumbakers Web Tools and SMS Trace so I put together a little something. I am far from being a proficient scripter and I’m sure there’s a much better way to do this. However this is what I came up with and so far it seams to be working flawlessly. One note – each log file needs to be added manually, in this example I have only added four of them. First – Edit MachRest.asp to add a drop down list with the log files names and then add a submit button.

-------------------------------------------------------------------------------------------->
<P><strong><font size="2">Open Remote Log File.</font></strong></P>
<P><SELECT id="Select2" style="FONT-SIZE: 10pt" size="1" name="Select2">
<option selected>ccmexec.log
<option>execmgr.log
<option>locationservices.log
<option>patchuimonitor.log
</select>
<P><INPUT id="Button12" style="FONT-SIZE: 10pt" type="button" value="Open Log File " name="SndBtn2"></P>
<---------------------------------------------------------------------------------------------

Next I’ve created the subroutine that will open the log files. Copy and paste this into MachRest after the last Sub/end Sub routine, just before the </script>

----------------------------------------------------------------------------------->
Sub SndBtn2_OnClick
on error resume next

  DIM CompName
CompName = trim(document.frmMain.txtValue.value)

Dim logValue
logValue = document.frmMain.select2.selectedIndex

dim oWshShell
Set WShell = CreateObject("WScript.Shell")
Set fso = createobject("scripting.filesystemobject")
strExe = "\\" & servername $ "\Remote$\trace32.exe"
If NOT fso.FileExists(strExe) Then
  msgbox "Could not find SMS Trace."
Else
  if logValue = 0 Then
logFile = "ccmexec.log"
end if

if logValue = 1 Then
logFile = "execmgr.log"
end if

If logValue = 2 Then
logFile = "locationservices.log"
end if

if logValue = 3 Then
logfile = "patchuimonitor.log"
End If

 
      WShell.Run  strExe & " \\" & CompName & "\C$\windows\system32\ccm\logs\" & logFile
End If
End Sub
<------------------------------------------------------------------------------------------

anyways just wanted to pass that along in hopes that someone will find it useful.

Editing this to add - for this to work you als need to copy trace32.exe to the remote$ share.

neilp

< Message edited by xneilpetersonx -- 1/8/2007 1:19:37 PM >
Post #: 1
RE: Open SMS Log files remotely with Ron Crumbakers SMS... - 1/8/2007 12:51:31 PM   
cstauffer911

 

Posts: 49
Score: 2
Joined: 10/6/2006
Status: offline
Nicly done.

i edited it abit to fit my enviornment.

Top

<P><strong><font size="2">Open Remote Log File.</font></strong></P> 
   <P><SELECT id="Select2" style="FONT-SIZE: 10pt" size="1" name="Select2"> 
    <option selected>CAS.log
    <option>CcmExec.log
    <option>CertificateMaintenance.log
    <option>ClientIDManagerStartup.log
    <option>ClientLocation.log
    <option>ContentTransferManager.log
    <option>DataTransferService.log
    <option>execmgr.log
    <option>FileSystemFile.log
    <option>InventoryAgent.log
    <option>LocationServices.log
    <option>mtrmgr.log
    <option>PatchInstall.log
    <option>PatchUIMonitor.log
    <option>PolicyAgent.log
    <option>PolicyAgentProvider.log
    <option>PolicyEvaluator.log
    <option>RemCtrl.log
    <option>ScanWrapper.log
    <option>Scheduler.log
    <option>setuppolicyevaluator.log
    <option>SmsClientMethodProvider.log
    <option>smscliui.log
    <option>smscstat.log
    <option>SmsWusHandler.log
    <option>SrcUpdateMgr.log
    <option>StatusAgent.log
    <option>UpdateScan.log 
   </select> 
   <INPUT style="WIDTH: 180px; color:#000000; background-color:#C7E2FF" type="button" name="SndBtn2" id="Button12" value="Open Log File" Title="This button will allow you to review log files on the selected computer"> 



bottom
' Log File reader
Sub SndBtn2_OnClick 
on error resume Next 
  DIM CompName 
 CompName = trim(document.frmMain.txtValue.value) 
 
 Dim logValue 
 logValue = document.frmMain.select2.selectedIndex 
 
dim oWshShell 
Set WShell = CreateObject("WScript.Shell") 
Set fso = createobject("scripting.filesystemobject") 
ServerName = "ENHBGSMS03"
strExe = "\\" & ServerName & "\Remote$\trace32.exe" 
If NOT fso.FileExists(strExe) Then 
 msgbox "Could not find SMS Trace." 
Else 
   if logValue = 0 Then logFile = "CAS.Log" End If
If logValue = 1 Then logFile = "CcmExec.Log" End If 
if logValue = 2 Then logFile = "CertificateMaintenance.log" End If
if logValue = 3 Then logFile = "ClientIDManagerStartup.log" End If
if logValue = 4 Then logFile = "ClientLocation.log" End If
if logValue = 5 Then logFile = "ContentTransferManager.log" End If
if logValue = 6 Then logFile = "DataTransferService.log" End If
if logValue = 7 Then logFile = "execmgr.Log" End If
if logValue = 8 Then logFile = "FileSystemFile.log" End If
if logValue = 9 Then logFile = "InventoryAgent.log" End If
if logValue = 10 Then logFile = "LocationServices.log" End If
if logValue = 11 Then logFile = "mtrmgr.log" End If
if logValue = 12 Then logFile = "PatchInstall.Log" End If
if logValue = 13 Then logFile = "PatchUIMonitor.log" End If
if logValue = 14 Then logFile = "PolicyAgent.log" End If
if logValue = 15 Then logFile = "PolicyAgentProvider.log" End If
if logValue = 16 Then logFile = "PolicyEvaluator.log" End If
if logValue = 17 Then logFile = "RemCtrl.log" End If
if logValue = 18 Then logFile = "ScanWrapper.log" End If
if logValue = 19 Then logFile = "Scheduler.log" End If
if logValue = 20 Then logFile = "setuppolicyevaluator.log" End If
if logValue = 21 Then logFile = "SmsClientMethodProvider.Log" End If
if logValue = 22 Then logFile = "smscliui.log" End If
if logValue = 23 Then logFile = "smscstat.log" End If
if logValue = 24 Then logFile = "SmsWusHandler.Log" End If
if logValue = 25 Then logFile = "SrcUpdateMgr.log" End If
if logValue = 26 Then logFile = "StatusAgent.log" End If
if logValue = 27 Then logFile = "UpdateScan.Log" End If
 
  
      WShell.Run  strExe & " \\" & CompName & "\c$\windows\system32\ccm\logs\" & logFile 
End If 
End Sub 


There is how ever a flaw and i'm not sure how to fix it.

WShell.Run  strExe & " \\" & CompName & "\c$\windows\system32\ccm\logs\" & logFile

this line tell it to open the file in directory \\" & CompName & "\c$\windows
but it needs to be changed to allow for winnt directory
 
I tried both %winnt% and %systemroot% neither work.

(in reply to xneilpetersonx)
Post #: 2
RE: Open SMS Log files remotely with Ron Crumbakers SMS... - 1/8/2007 1:16:46 PM   
xneilpetersonx

 

Posts: 157
Score: 1
Joined: 7/18/2006
Status: offline
how about \admin$ ?

so you would have

"\\" & CompName & "\admin$\system32\ccm\logs\" & logfile

I have not tried this out, just guessing.



(in reply to cstauffer911)
Post #: 3
RE: Open SMS Log files remotely with Ron Crumbakers SMS... - 1/8/2007 2:31:29 PM   
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">&nbsp;</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.

(in reply to xneilpetersonx)
Post #: 4
RE: Open SMS Log files remotely with Ron Crumbakers SMS... - 1/9/2007 8:36:35 AM   
cstauffer911

 

Posts: 49
Score: 2
Joined: 10/6/2006
Status: offline
Admin$ did the trick.

Thanks
Chris Stauffer <><

(in reply to eschloss)
Post #: 5
Page:   [1]
All Forums >> [Management Products] >> Microsoft Systems Management Server >> SMS 2003 >> Open SMS Log files remotely with Ron Crumbakers SMS Remote Tools. Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts



  
Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.518