Skip to content

Commit

Permalink
Button to open execmgr.log and smsts.log
Browse files Browse the repository at this point in the history
  • Loading branch information
rzander committed May 20, 2021
1 parent 5d344f9 commit d191bc1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
13 changes: 13 additions & 0 deletions SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/AdvertisementGrid.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@
<CheckBox Name="cb_TSAdv" IsChecked="True" Checked="cb_TSAdv_Checked" Unchecked="cb_TSAdv_Unchecked">Hide TS Advertisements</CheckBox>
</StackPanel>
</Button>
<Separator />
<Button ToolTip="Open execmgr.log" Name="bt_OpenExecmgr" Click="Bt_OpenExecmgr_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/SCCMCliCtrWPF;component/Images/Search File.ico"/>
<TextBlock Margin="2,0,0,0">execmgr.log</TextBlock>
</StackPanel>
</Button>
<Button ToolTip="Open smsts.log" Name="bt_OpenExecmg" Click="Bt_OpenSMSTS_Click">
<StackPanel Orientation="Horizontal">
<Image Source="/SCCMCliCtrWPF;component/Images/Search File.ico"/>
<TextBlock Margin="2,0,0,0">smsts.log</TextBlock>
</StackPanel>
</Button>
</ToolBar>
</DockPanel>
<DockPanel>
Expand Down
33 changes: 33 additions & 0 deletions SCCMCliCtrWPF/SCCMCliCtrWPF/Controls/AdvertisementGrid.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,39 @@ private void cb_TSAdv_Unchecked(object sender, RoutedEventArgs e)
Properties.Settings.Default.Save();
}
}

private void Bt_OpenExecmgr_Click(object sender, RoutedEventArgs e)
{
OpenCCMLog("execmgr.log");
}

private void Bt_OpenSMSTS_Click(object sender, RoutedEventArgs e)
{
OpenCCMLog("smsts.log");
}

private void OpenCCMLog(string LogFile)
{
Mouse.OverrideCursor = Cursors.Wait;
try
{
Process Explorer = new Process();
Explorer.StartInfo.FileName = "Explorer.exe";

//Connect IPC$ if not already connected (not needed with integrated authentication)
if (!oAgent.ConnectIPC_)
oAgent.ConnectIPC_ = true;

string LogPath = oAgent.Client.AgentProperties.LocalSCCMAgentLogPath.Replace(':', '$');
Explorer.StartInfo.Arguments = @"\\" + oAgent.TargetHostname + "\\" + LogPath + "\\" + LogFile;

Explorer.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
Explorer.Start();
}
catch (Exception ex) { Listener.WriteError(ex.Message); }

Mouse.OverrideCursor = Cursors.Arrow;
}
}

public class StatusConverter : IMultiValueConverter
Expand Down

0 comments on commit d191bc1

Please sign in to comment.