Cmrcviewer logging with powershell

 

 

A while back a user on reddit in the/R/SCCM section asked a question regarding Cmrcviewer.exe and if it was possible to see the history of the connections you had made since the user always forgot to write down which IP or Computer name he was connecting to. You can find the post here tho the users question has been deleted, the answers are still there. The user also wanted it to be persistent so he didn’t had to open a new powershell session every time so thanks to /U/BIGINIME for answering that.

 

A simple solution i came up with for solving this problem was to write a powershell script that launched Cmrcviewer.exe and which also created a .log file with Date/Time and computer name for each connection.

 

The Script

 

While (1 -eq 1)
{

$Computername = read-host "Enter Computer name"
$logpath = "C:\cmrcviewer.log"
$CmRcViewer = "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\CmRcViewer.exe"  

if ($Computername -ne $Null) 
{ 
    & $CmRcViewer $Computername $date = Get-Date Out-File -FilePath $logpath -InputObject "$date - $Computername" -Append 
}   
} 

The only changes you need to do is to the 2 variables $logpath if you want another path and to $Cmrcviewer where you need to specify where the Cmrcviewer.exe is located.

 

Process

 

First of all save the powershell script to a .ps1 file and start with right clicking on it and choose “Run with powershell”

 

3

 

Enter computer name or IP to which computer you want to connect to in to the powershell window and press enter

 

4

 

From there cmrcviewer.exe will start and the log file will update

5

6

 

Until next time, cheers Timmy !

 

You can find me over at

 

 

#todo