How to report if Microsoft Outlook Cache Mode Status Using Custom Inventory is used?
ITMS 8.x
Inventory Solution 8.x
Custom inventory can be used to detect the cache mode status on computers by querying registry keys. The Custom Inventory script presented here was adapted from Get Outlook cache mode status custom inventory to be able to detect cache mode for Microsoft Outlook 2007, 2010 and 2013. In addition this article presents a custom report that displays the custom inventory data. Please note that Symantec Support does not support custom scripting or reporting so modifications to the script and report must be made by the user.
'*** Altiris NSE section
'Create instance of Altiris NSE component
dim nse
set nse = WScript.CreateObject ("Altiris.AeXNSEvent")
' Set the header data of the NSE
' Please don't modify this GUID
nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
nse.Priority = 1
'Create Inventory data block. The following data class with below guid is already configured on server.
dim objDCInstance
set objDCInstance = nse.AddDataClass ("Outlook Cache Mode")
'If the dataclass name does not work then use its guid (will be different in each environment)
'set objDCInstance = nse.AddDataClass ("{0543bf90-028e-4dca-9e0e-c2239cfa35d1}")
dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)
dim objDataRow
'*** Custom Inventory section
Const HKEY_USERS = &H80000003
Const HKEY_CURRENT_USER = &H80000001 'HKEY_CURRENT_USER
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
'Pull all profiles from HKEY_USERS registry
oReg.EnumKey HKEY_USERS, "", arrSubProfKeys
'Check for Outlook 2013
If oReg.EnumKey(HKEY_CURRENT_USER, "Software\Microsoft\office\15.0\Outlook\profiles\outlook", arrSubKeys) = 0 Then
'Pull profile keys from each profile found
For Each oSubProfKey in arrSubProfKeys
strKeyPath2013a = oSubProfKey & "\Software\Microsoft\office\15.0\Outlook\profiles\outlook"
oReg.EnumKey HKEY_USERS, strKeyPath2013a, arrSubKeys1
On Error Resume Next
For Each oSubKey1 In arrSubKeys1
strFullKeyPath2013 = strKeyPath2013a & "\" & oSubKey1
oReg.GetBinaryValue HKEY_USERS, strFullKeyPath2013, "00036601", sValue
strCacheStatus = Join(sValue)
If strCacheStatus <> "" Then
Select Case strCacheStatus
Case "4 16 0 0", "6 16 0 0" 'The off code 4 10 0 0 gets distorted by the string conversion
strCacheMode = "Off"
Case Else
strCacheMode = "On"
End Select
oReg.GetStringValue HKEY_USERS, strFullKeyPath2013, "001e6603", cnUserName
ArrUserName = Split(cnUserName, "=")
strUserName = ArrUserName(4)
oReg.GetStringValue HKEY_USERS, strFullKeyPath2013, "001e6750", strProfile
'Add a new row to the NSE file
set objDataRow = objDataClass.AddRow
'Set columns
objDataRow.SetField 0, strUserName
objDataRow.SetField 1, strProfile
objDataRow.SetField 2, strCacheMode
End If
strCacheStatus = ""
Next
Next
Else
'Loop for older versions of Outlook
'Pull profile keys from each profile found
For Each oSubProfKey in arrSubProfKeys
strKeyPath1 = oSubProfKey & "\Software\Microsoft\Windows NT\CurrentVersion\Windows Messaging Subsystem\Profiles"
oReg.EnumKey HKEY_USERS, strKeyPath1, arrSubKeys1
On Error Resume Next
For Each oSubKey1 In arrSubKeys1
strKeyPath2 = strKeyPath1 & "\" & oSubKey1
oReg.EnumKey HKEY_USERS, strKeyPath2, arrSubKeys2
For Each oSubKey2 In arrSubKeys2
strFullKeyPath = strKeyPath2 & "\" & oSubKey2
'Retrieve Cache Mode, User name, and Outlook Profile Name key
oReg.GetBinaryValue HKEY_USERS, strFullKeyPath, "00036601", sValue
strCacheStatus = Join(sValue)
If strCacheStatus <> "" Then
Select Case strCacheStatus
Case "4 0 0 0", " 4 0 0 0", "4 16 0 0"
strCacheMode = "Off"
Case Else
strCacheMode = "On"
End Select
oReg.GetStringValue HKEY_USERS, strFullKeyPath, "001e6603", cnUserName
ArrUserName = Split(cnUserName, "=")
strUserName = ArrUserName(4)
oReg.GetStringValue HKEY_USERS, strFullKeyPath, "001e6750", strProfile
'Add a new row to the NSE file
set objDataRow = objDataClass.AddRow
'Set columns
objDataRow.SetField 0, strUserName
objDataRow.SetField 1, strProfile
objDataRow.SetField 2, strCacheMode
End If
strCacheStatus = ""
Next
Next
Next
End If
' Send the NSE file to the NS server
nse.SendQueued
select vComputer.Name [Computer], iOCM.[User Name], iOCM.[Profile], iOCM.[Cache Mode] from Inv_Outlook_Cache_Mode iOCM
left join vComputer on vComputer.Guid = iOCM._ResourceGuid