<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Office Diagnostics</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/officediagnostics/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/officediagnostics/feed.xml</link>
    <description />
    <lastBuildDate>Wed, 17 Apr 2019 03:47:25 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Controlling the OffCAT background process (OffCAT_RTS.exe)</title>
      <link>https://docs.microsoft.com/archive/blogs/officediagnostics/controlling-the-offcat-background-process-offcat_rts-exe</link>
      <pubDate>Wed, 14 Mar 2018 15:27:35 GMT</pubDate>
      <dc:creator><![CDATA[Greg Mansius]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/officediagnostics/?p=55</guid>
      <description><![CDATA[Intro
OffCAT uses an automatic background process (OffCAT_RTS.exe, but referred to as RTS) to...]]></description>
      <content:encoded><![CDATA[<h1><span style="color: #333399">Intro</span></h1>
<span><span style="font-family: Calibri">OffCAT uses an automatic background process (OffCAT_RTS.exe, but referred to as <i>RTS</i>) to respond to known Office program crashes and to check for updated rule or application files. This background process is also responsible for uploading OffCAT telemetry. The background OffCAT process does not intentionally capture information that identifies you. However, the telemetry may indirectly capture strings such as file paths that include identifying data such as user ID.</span></span>

<span><span style="font-family: Calibri"> </span></span><span><span style="font-family: Calibri">This background  process can be fully managed using the following registry data:</span></span>
<ul>
 	<li><span><span style="font-family: Calibri"><strong>Key</strong>: HKEY_CURRENT_USER\Software\Microsoft\OffCAT</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>DWORD</strong>: RTSMode</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Value</strong>: &lt;<em>see possible values below</em>&gt;</span></span></li>
</ul>
<h2><span style="color: #000080">How to update the Windows registry</span></h2>
<span><span style="font-family: Calibri">You can use the following steps to update the Windows registry with the desired value for <strong>RTSMode</strong>:</span></span>
<ol>
 	<li><span><span style="font-family: Calibri">Click <strong>Start</strong>, type regedit in the <strong>Start search</strong> box, and then click <strong>regedit.exe</strong> in the <strong>Programs</strong> list.</span></span></li>
 	<li><span><span style="font-family: Calibri">In Registry Editor, locate the following subkey for OffCAT.
<span style="color: #800080">HKEY_CURRENT_USER\Software\Microsoft\OffCAT</span>
</span></span></li>
 	<li><span><span style="font-family: Calibri">On the <strong>Edit</strong> menu, point to <strong>New</strong>, click <strong>DWORD Value</strong>, type <strong>RTSMode</strong>, and then press ENTER.</span></span></li>
 	<li><span><span style="font-family: Calibri">Right-click <strong>RTSMode</strong>, and then click <strong>Modify</strong>.</span></span></li>
 	<li><span><span style="font-family: Calibri">In the <strong>Value data</strong> box, type the desired value (<em>see possible and example values below</em>), and then click <strong>OK</strong>.</span></span></li>
 	<li><span><span style="font-family: Calibri">Exit Registry Editor.</span></span></li>
</ol>
<h2><span style="color: #000080">Possible values for RTSMode</span></h2>
<ul>
 	<li><span><span><span style="font-family: Calibri"><strong>Notifications</strong>
By default, RTS displays alerts to let you know, for example, that a known crash has been detected – as shown in the following figure.
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/Fix-this-crash-alert.jpg"><img width="249" height="61" class="alignnone size-full wp-image-75" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/Fix-this-crash-alert.jpg" /></a>
To turn off these notifications, set <strong>RTSMode=1</strong> (Hexadecimal).
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-1.png"><img width="300" height="167" class="alignnone size-medium wp-image-65" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-1-300x167.png" /></a>
</span></span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Crash detection</strong>
If RTS detects a known crash in an Office program, the alert shown in the above figure is displayed.
To turn off known crash detection, set <strong>RTSMode=2</strong> (Hexadecimal).
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-2.png"><img width="300" height="167" class="alignnone size-medium wp-image-85" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-2-300x167.png" /></a>
</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Rule file and application update</strong>s
RTS periodically checks the download locations for rule files and for OffCAT application files to see if newer versions are available.
To turn off this update check, set <strong>RTSMode=20</strong> (Hexadecimal).
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-20.png"><img width="300" height="167" class="alignnone size-medium wp-image-95" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-20-300x167.png" /></a>
</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Windows notification area icon for OffCAT</strong>
To turn off the display of the OffCAT icon in the Windows notification area, set <strong>RTSMode=40</strong> (Hexadecimal).
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-40.png"><img width="300" height="167" class="alignnone size-medium wp-image-105" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-40-300x167.png" /></a>
</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Run on-demand only</strong>
You can configure RTS so that it will run only when OffCAT.exe or OffCATCMD.exe are running or when the OffCAT add-in is loaded in an Office program.
This can be done by setting <strong>RTSMode=1000</strong> (Hexadecimal).
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-1000.png"><img width="300" height="167" class="alignnone size-medium wp-image-115" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-1000-300x167.png" /></a>
</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Telemetry</strong>
To stop RTS from uploading OffCAT telemetry, set <strong>RTSMode=8000000</strong> (Hexadecimal),
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-8000000.png"><img width="300" height="167" class="alignnone size-medium wp-image-125" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-8000000-300x167.png" /></a>
which is the same thing as <strong>134217728</strong> (Decimal).
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-134217728decimal.png"><img width="300" height="167" class="alignnone size-medium wp-image-135" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-134217728decimal-300x167.png" /></a>
</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Disable RTS</strong>
To completely disable all background functionality provided by RTS, set <strong>RTSMode=ffffffff</strong> (Hexadecimal),
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-ffffffff.png"><img width="300" height="167" class="alignnone size-medium wp-image-155" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-ffffffff-300x167.png" /></a>
which is the same thing as <strong>4294967295</strong> (Decimal).
<a href="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-4294967295decimal.png"><img width="300" height="167" class="alignnone size-medium wp-image-145" alt="" src="https://msdnshared.blob.core.windows.net/media/2018/03/rtsmode-4294967295decimal-300x167.png" /></a>
</span></span></li>
</ul>
<h3><span style="color: #000080">Example values for RTSMode</span></h3>
<span><span style="font-family: Calibri">All of the above values can be combined to give you a customized experience. Here are some examples:</span></span>
<ul>
 	<li><span><span style="font-family: Calibri"><strong>Disable notification area alerts</strong> (<em>RTSMode=1</em>) plus <strong>disabling the crash detection feature</strong> (<em>RTSMode=2</em>)
Set <strong>RTSMode = 3</strong> (Hexadecimal)</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Run in on-demand mode</strong> (<em>RTSMode=1000</em>) plus <strong>disable the notification area icon</strong> (<em>RTSMode=40</em>)
Set <strong>RTSMode=1040</strong> (Hexadecimal)</span></span></li>
 	<li><span><span style="font-family: Calibri"><strong>Disable the rule file update check</strong> (<em>RTSMode=20)</em> plus <strong>disable OffCAT telemetry</strong> (<em>RTSMode=8000000</em>)
Set <strong>RTSMode=8000020</strong> (Hexadecimal):</span></span></li>
</ul>]]></content:encoded>
    </item>
    <item>
      <title>Script OffCAT for use in an Enterprise</title>
      <link>https://docs.microsoft.com/archive/blogs/officediagnostics/script-offcat-for-use-in-an-enterprise</link>
      <pubDate>Thu, 15 Oct 2015 07:57:00 GMT</pubDate>
      <dc:creator><![CDATA[jojo1962]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.technet.microsoft.com/officediagnostics/2015/10/15/script-offcat-for-use-in-an-enterprise/</guid>
      <description><![CDATA[The Microsoft Office Configuration Analyzer Tool (OffCAT) is a powerful tool that detects several...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family:Calibri;font-size:medium;">The <a href="https://support.microsoft.com/kb/2812744">Microsoft Office Configuration Analyzer Tool</a> (OffCAT) is a powerful tool that detects several hundred known issues about Office programs and displays the results (in a scan report) with a solution link to for each detected issue. The report also includes a detailed tree-report display of several thousand configuration settings from the scanned machine as well as the results of a Calendar scan (using CalCheck) when Outlook is the scanned program. But, there are some important factors to consider when using OffCAT in a global enterprise with many subsidiaries/locations and users with varied technical backgrounds.</span></p>
<ul>
<li>
<p>Not all users in the enterprise may have Internet access</p>
</li>
<li>
<p>You want to hide the detailed OffCAT scan results from the user</p>
</li>
<li>
<p>You want to minimize the administrative overhead when creating packages for each new OffCAT version</p>
</li>
</ul>
<p><span style="font-family:Calibri;font-size:medium;">If any of these items&nbsp;are a concern for you, then one approach is to script the command-line version of OffCAT instead of installing the OffCAT program on Office clients. <span style="font-family:Calibri;font-size:medium;">Then, Help Desk personnel can open the scan results in the full OffCAT client to determine the follow-up resolution/troubleshooting steps for the user</span>. Briefly, the script can:</span></p>
<ol>
<li>
<p>Copy the needed OffCAT files from a network share to the client on which the script is being run.</p>
</li>
<li>
<p>Start the OffCAT scan using the command-line executable OffCATcmd.exe.</p>
</li>
<li>
<p>Email the results to a Help Desk distribution group.</p>
</li>
</ol>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">In this blog post, the different components of an example script (attached) are provided and discussed so that you follow along with the explanations provided below. Then, you can develop your own script based on these building blocks and ideas.<br /></span></p>
<h2><span style="color:#2e74b5;font-family:Calibri Light;font-size:large;">Example script solution</span></h2>
<p><span style="font-family:Calibri;font-size:medium;">Use the following steps to implement a scripted solution for OffCAT.</span></p>
<ul>
<li>
<p><b>Create a network share where all clients that may be scanned have Read access. <br /></b>If done correctly,&nbsp;it should look like this:</p>
<a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/04/76/P1.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-04-76/P1.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/04/76/P1.png" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-04-76/P1.png" border="0" /></a><img alt=" " /></li>
</ul>
<p><span style="font-family:Calibri;font-size:medium;">To do this you need to download and install <a title="OffCAT" href="https://www.microsoft.com/download/details.aspx?id=36852" target="_blank">OffCAT</a>. Use the installed files as a source for the files you copy to the share. After doing this, you should have created the above file and folder structure in the share.</span></p>
<ul>
<li>
<p><b>Determine the scope of the script. </b></p>
</li>
</ul>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:medium;">But, before you code the script, a few decisions have to be made:</span></p>
<ul>
<li style="list-style-type:none;">
<ul>
<li>
<p><b>Decide what applications you want to scan</b>.</p>
</li>
</ul>
</li>
</ul>
<p style="margin-left:90px;"><span style="font-family:Calibri;"><span style="font-size:medium;">It is possible to scan just one Office program, all Office programs, or every possible subset of Office programs<em><span style="color:#5b9bd5;">. In our script example it&nbsp;is possible to scan one&nbsp;Office program&nbsp;or all Office programs.</span></em></span></span></p>
<ul>
<li style="list-style-type:none;">
<ul>
<li>
<p><b>Determine the Office Version you need to scan. </b></p>
</li>
</ul>
</li>
</ul>
<p style="margin-left:90px;"><span style="font-family:Calibri;"><span style="font-size:medium;">Maybe you have a mixed environment where different Office versions are installed. <em><span style="color:#5b9bd5;">In our example, we scan Office 2013 if it is installed. If not, Office 2010 is scanned.</span></em></span></span></p>
<ul>
<li style="list-style-type:none;">
<ul>
<li>
<p><b>Know the <i>Type</i> of installation that has to be scanned. </b></p>
</li>
</ul>
</li>
</ul>
<p style="margin-left:90px;"><span style="font-family:Calibri;"><span style="font-size:medium;">You may mix C2R-Installations and MSI-Installations within your company, but it is not possible to mix it on one client. So, you may need to check for the Office installation <em>Type</em> on the machine.<em><span style="color:#5b9bd5;"> The command-line argument for OffCATcmd.exe requires that you specify the installation Type that&#39;s being scanned.</span></em></span></span></p>
<ul>
<li style="list-style-type:none;">
<ul>
<li>
<p><b>Decide how to start the script and handle the completed scans. </b></p>
</li>
</ul>
</li>
</ul>
<p style="margin-left:90px;"><span style="font-family:Calibri;font-size:medium;">Since you are proobably trying to limit the amount of effort required by end-users, you can start the script using a link provided to the user (by email?) and you can also email the scan results back to the Help Desk.</span></p>
<p style="margin-left:90px;"><em><span style="color:#5b9bd5;font-family:Calibri;font-size:medium;">For our solution, we send an email message to the client with a link to the script.&nbsp;The script also includes the option to either&nbsp;automatically reply back with the scan file attached (as .zip)&nbsp;or not respond back at all (leaving the file(s) on the drive).</span></em></p>
<ul>
<li style="list-style-type:none;">
<ul>
<li>
<p><b>Pick a scripting language you will use to build the solution. </b></p>
</li>
</ul>
</li>
</ul>
<p style="margin-left:90px;"><span style="font-family:Calibri;font-size:medium;">We recommend PowerShell for maximum forward-compatibility. When you use PowerShell the access policy needs to be considered to secure the solution. For example, the script needs to be signed.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">After you have decided on these things, you can start to code.</span></p>
<ul>
<li>
<p><b>Create the script</b></p>
</li>
</ul>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:medium;">After the necessary OffCAT files are copied to a network share and you have decided the scope of the script, the next step is to create the script.</span></p>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:medium;">We start the sample script by defining an enum for the different Office applications we want to scan. In this case, we created the enum to be able to scan everything (All) or one single application.</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">Add-Type -TypeDefinition @&quot;</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">public enum OfficeApp</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">{</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; All,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Access,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Excel,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; InfoPath,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; OneNote,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Outlook,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Powerpoint,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Publisher,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Word,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Visio</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">}</span></p>
<p style="margin-left:60px;"><span style="font-family:Calibri;font-size:small;"><span style="color:#3366ff;">&quot;@</span> </span></p>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:medium;">Then, we create one enum for the Office Version. We need to scan either Office 2010 or 2013.</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">Add-Type -TypeDefinition @&quot;</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">public enum OfficeVersion</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">{</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; O14 = 14,</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; O15 = 15</span></p>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">}</span></p>
<p style="margin-left:60px;"><span style="font-family:Calibri;font-size:small;"><span style="color:#3366ff;">&quot;@</span> </span></p>
<p><span style="font-family:Calibri;font-size:medium;">The function to start the scan comes next:</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">function runoffcat{</span></p>
<p><span style="font-family:Calibri;"><span style="font-size:medium;">To keep a large number of scans organized when the Help Desk is reviewing OffCAT scans using the full OffCAT client, there should be a uniquie &ldquo;speaking name&rdquo; for every scan. In the script, the scan filename includes the <i>scanned Office Application</i> (the function gets as an argument), the <i>machine name</i> and the <i>timestamp</i> when the scan was taken:</span></span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">$resultfile = $args[0]+&#39;_&#39;+$machinename+&#39;_&#39;+(Get-Date -format dd-mm-yy)+&#39;.xml&#39;</span></p>
<p>&nbsp;<span style="font-family:Calibri;font-size:medium;">OffCATcmd.exe requires several command-line arguments. The values are set in the management part of the script and result is used here.</span></p>
<ul>
<li>
<p>The Office version that will be scanned as argument by calling the function:</p>
</li>
</ul>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">$args[0]</span></p>
<ul>
<li>
<p>Office <i>version</i> that will be scanned:</p>
</li>
</ul>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;$OVersion.value__</span></p>
<ul>
<li>
<p>The <i>type</i> of the installation:</p>
</li>
</ul>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">Installtype msi&#39;</span></p>
<ul>
<li>
<p>A few needed Parameters(For detailed descriptions, see <a href="https://www.microsoft.com/download/details.aspx?id=36852"><span style="color:#0563c1;">OffCAT v2.1 ReadMe.docx</span></a>):</p>
</li>
</ul>
<p style="margin-left:60px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">-AE -ND -NoRTS</span></p>
<ul>
<li>
<p>And the location to save the scans:</p>
</li>
</ul>
<p style="margin-left:60px;"><span style="font-family:Calibri;font-size:small;"><span style="color:#3366ff;">$resultpath and $resultfile</span> </span></p>
<p><span style="font-family:Calibri;font-size:medium;">This all combines to one Parameter String, that can be passed to the commandlet (for -ArgumentList).</span></p>
<p style="margin-left:30px;"><span style="font-size:small;"><span style="color:#3366ff;">&nbsp;</span><span style="font-family:Calibri;"><span style="color:#3366ff;">$offcatargs= &#39;-cfg &#39;+$args[0]+&#39; -gs MajorVersion &#39;+$OVersion.value__+&#39; Installtype msi&#39;,&#39;-AE&#39;,&#39;-ND&#39;,&#39;-NoRTS&#39;,&#39;-dat &quot;&#39;+$resultpath+&quot;\&quot;+$resultfile+&#39;&quot;&#39;</span> </span></span></p>
<p>&nbsp;<span style="font-family:Calibri;font-size:medium;">Use the <b>Start-Process</b> Commandlet to start the OffCATcmd, pass the Arguments and control the number of windows, that are opened.</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-size:small;"><span style="font-family:Calibri;">&nbsp;</span><span style="font-family:Calibri;">Start-Process $localpath\Offcatcmd.exe -ArgumentList $offcatargs &ndash;NoNewWindow</span></span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;Then, wait </span><span style="font-family:Calibri;font-size:medium;">for the running OffCATcmd&nbsp;process until going on. (There is only one OffCATcmd.exe process that can be running at&nbsp;one time.)</span></p>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:medium;">&nbsp;</span><span style="color:#3366ff;font-family:Calibri;font-size:small;">$proc = Get-Process OffCATcmd</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wait-Process -InputObject $proc</span></p>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:small;"><span style="color:#3366ff;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span> </span></p>
<p><span style="font-family:Calibri;font-size:medium;">This was the heart of the solution. Now the <i>management</i> part should be defined.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">The first step are the <b>Parameters</b> we need. These you can take from the <em>decisions</em> discussed previously:</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">param(</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; [Parameter(mandatory=$true, Position = 1)] [OfficeApp]$toScan,</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; [Parameter(Position = 2)] [boolean]$Mail = $false,</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; [Parameter(Position=3)] [OfficeVersion]$OVersion = [OfficeVersion]::O14</span></p>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:small;"><span style="color:#3366ff;">&nbsp;&nbsp;&nbsp; )</span> </span></p>
<p><span style="font-family:Calibri;font-size:medium;">At the beginning of the script development we wanted to start the script from an email message sent to the user and and then a replying email to the sender would include the scan result. After a time using the script we decided to include the option to use it without email. Otherwise, it is only possible to run a scan when Outlook is working!</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&quot; UseOffcat for Office Apps:&quot;+$toScan +&quot; Office Version=&quot;+$OVersion+&quot; and send a Mail:&quot;+$Mail.ToString()</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">#Check only for outlook if a Mail should be sent</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">if ($Mail -eq $true)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">{</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; #Create Outlook Object - Mail is opened becaus clicking the link initiates the Process</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $outlook = New-Object -ComObject Outlook.Application</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; #Ticketnumber and Sender read from Mail with Link - Should be active Mail in Explorer no matter if the Mail is opened in Inspector or not</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $Exp = $outlook.ActiveExplorer()</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $prev = $Exp.Selection.Item(1)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; if ($prev.MessageClass.ToString() -eq &quot;IPM.Note&quot;){</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $sender = $prev.SentOnBehalfOfName</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $TicketNo = $prev.Subject</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; }<br />}</span></p>
<p><span style="font-family:Calibri;font-size:medium;">That&rsquo;s why the part for sending the email message&nbsp;is included in a <em>condition</em>.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">The check for the installed Office version that is installed may be different depending on the version that is installed. At my customer we needed to check only for Office 2013 (15):</span></p>
<p style="margin-left:30px;"><span style="font-family:Calibri;font-size:small;"><span style="color:#3366ff;">test-path HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Office15.PROPLUS</span> </span></p>
<p><span style="font-family:Calibri;font-size:medium;">After this, we defined the values for the network source location containing all of the OffCAT source files, and where to temporarily save the files locally on the client that will be scanned. </span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">$srcdir = &lt;Path of the rules files&gt;</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">$cmddir = &lt;Path of Programm and dll files including tools&gt;</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">$localpath = (Get-Content env:LOCALAPPDATA) + &quot;\Microsoft\offcat&quot;</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">$resultzip = &lt;Name of compressed resultlile&gt;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">Note, it is possible to use the files directly from the share to do the scan; however, <span style="text-decoration:underline;">we recommend copying the files to the client</span>. In our tests we had various problems when we did not copy them locally. This is why we decided against using the files directly from the network share.</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">if (test-path $localpath){remove-item $localpath -Recurse -Force}</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; New-item -path $localpath\Tools\x86 -ItemType directory</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; New-item -path $localpath\en -ItemType directory</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; foreach ($item in (Get-ChildItem $srcdir)) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Copy-Item $item.FullName $localpath\en</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; }</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; foreach ($cmditem in (Get-ChildItem $cmddir)) {</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($cmditem.Extension){</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Copy-Item $cmditem.FullName $localpath<br />&nbsp;&nbsp;&nbsp; }}</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; foreach ($cmditem in (Get-ChildItem $cmddir\Tools\x86)) {</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Copy-Item $cmditem.FullName $localpath\Tools\x86<br />&nbsp;&nbsp;&nbsp; }</span></p>
<p><span style="font-family:Calibri;font-size:medium;">Before scanning Office there are a few variables we need to define and then we can check the Parameter for the Office Application that should be scanned. We create a condition if we need to scan everything or just one Application. If we need to scan everything we loop through the <span style="color:#3366ff;">enum</span> and scan for </span><span style="font-size:small;">every</span><span style="font-family:Calibri;font-size:medium;"> Application in the enum.</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">If($toScan -eq [OfficeApp]::All)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;{</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; Foreach ($Oitem in [OfficeApp].GetEnumValues())</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; {</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(-Not ($Oitem -eq &quot;All&quot;))</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; runoffcat($Oitem.ToString())</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp; }</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;} else {</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; runoffcat ($toScan.ToString())</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;}</span></p>
<p><span style="font-family:Calibri;"><span style="font-size:medium;">After the scans are complete we compress the results. To do this we use the assembly for creating zip files (System.IO.Compression.FileSystem)</span></span></p>
<p><span style="font-family:Calibri;"><span style="font-size:medium;">If we do not email the results we copy the zip file to the temp folder (%temp%), and then we can delete the OffCAT-files at the end.</span></span></p>
<p style="margin-left:30px;"><span style="font-family:Calibri;"><span style="font-size:medium;">&nbsp;<span style="color:#3366ff;font-size:small;">&quot;Creating compressed file&quot;</span></span></span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;Add-Type -Assembly &quot;System.IO.Compression.FileSystem&quot; ;</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;if ($Mail -eq $true)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;{<br />&nbsp;&nbsp;&nbsp; [System.IO.Compression.ZipFile]::CreateFromDirectory($resultpath, $localpath+$resultzip)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; } else {</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; &quot;No Mail sent, so create the zip in temp directory&quot;</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; (Get-Content env:temp)+$resultzip</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; if (Test-Path ((Get-Content env:temp)+$resultzip)) {remove-item ((Get-Content env:temp) + $resultzip) -Force}</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; [System.IO.Compression.ZipFile]::CreateFromDirectory($resultpath, ((Get-Content env:temp) + $resultzip))</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; }</span></p>
<p><span style="font-family:Calibri;font-size:medium;">The next step is to send the results by email (if this option is enabled). </span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">if ($Mail -eq $true)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">{</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; #Mail to sender including the Ticketnumber (in subject)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; &quot;Start sending mail&quot;</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $mail = $outlook.CreateItem(0)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $mail.To = $sender</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $mail.Subject = $TicketNo</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $mail.Body = &quot;Das Offcat Ergebnis &quot;</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $mail.Attachments.Add($localpath+$resultzip)</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; #save the mail if anything happens during the send process</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $mail.Save()</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; $mail.Send()</span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">&nbsp;&nbsp;&nbsp; &quot;Mail with offcat logs sent&quot;<br />}</span></p>
<p><span style="font-family:Calibri;font-size:medium;">At the end, all files that were either copied down from the network share or created during the scan are deleted. </span></p>
<p style="margin-left:30px;"><span style="color:#3366ff;font-family:Calibri;font-size:small;">if (test-path $localpath){remove-item $localpath -Recurse -Force}</span></p>
<p><span style="font-family:Calibri;font-size:medium;">This way, there are no OffCAT files left on the client after the scan.</span></p>
<h2><span style="color:#2e74b5;font-family:Calibri Light;font-size:large;">Maintenance items</span></h2>
<p><span style="font-family:Calibri;font-size:medium;">There are two things to maintain when choosing this solution for your company:</span></p>
<ul>
<li>
<p><b>Keep the rule files in the source directory up-to-date</b></p>
</li>
<li>
<p><b>Change the exe files and dll files if there is a new version of OffCAT available</b></p>
</li>
</ul>
<p><span style="font-family:Calibri;font-size:medium;">You should run OffCAT at least a couple times each month to see if new rule files are available or if the application version has changed. Click the &lsquo;About OffCAT&rsquo; control on the OPTIONS page to get the version numbers of the rule files and the OffCAT application.</span></p>
<p><span style="font-family:Calibri;font-size:medium;">In our environment, we use one installation of OffCAT that will be updated to get the actual rule files. Those files&nbsp;are copied to the share.</span></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/04/76/P2.png" original-url="https://blogs.technet.com/cfs-file.ashx/__key/communityserver-blogs-components-weblogfiles/00-00-01-04-76/P2.png"><img alt=" " src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/01/04/76/P2.png" original-url="https://blogs.technet.com/resized-image.ashx/__size/550x0/__key/communityserver-blogs-components-weblogfiles/00-00-01-04-76/P2.png" border="0" /></a></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;</span></p>
<p><span style="font-family:Calibri;font-size:medium;">&nbsp;<strong><span style="color:#ff6600;">Joachim Fumy</span></strong></span></p>
<p></p>
<p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/prod.evol.blogs.technet.com/telligent.evolution.components.attachments/01/10476/00/00/03/65/57/23/Offcatuse_Blog.ps1" original-url="https://blogs.technet.com/cfs-filesystemfile.ashx/__key/telligent-evolution-components-attachments/01-10476-00-00-03-65-57-23/Offcatuse_5F00_Blog.ps1">Offcatuse_Blog.ps1</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>