Quantcast
Channel: Symantec Connect
Viewing all articles
Browse latest Browse all 26913

NS7.1 Custom inventory help - registry values

$
0
0
ソリューションが必要です

Hi folks,

I need some help with a custom inventory of a registry key. I have scoured the forums here, and found many helpful articles, which have gotten me as far as I have. I have created a custom dataclass and modified the sample Windows custom inventory script for registry data - all of this was a lot simpler than I expected it to be. However, something isn't working, so obviously I've done something wrong. After running my custom inventory on a client, my dataclass is still empty.

What I am trying to do: I am attempting to query ONE registry key: “HKLM\SOFTWARE\Nico Mak Computing\WinZip\WinIni" to grab 7 registry values. Later, we will create a filter based upon these values in order to set up an Application Metering policy to block unlicensed copies of Winzip. Can anyone identify what I am doing wrong?

Here is an example of the Winzip "Winini" registry key I am trying to grab data from. This computer only has 2 of the 7 registry values I want to grab. As you can see, this will be a pretty simple registry inventory. No multiple keys, just multiple values within the same registry key.

 

So, based on that registry key, I made the following data class:

 

Lastly, there is my script:

'Gather registry key value from machine and posting data to NS using Altiris NSE Component
'===================================================================================================================
'      On Error Resume Next

const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."
Set oReg=GetObject( _
   "winmgmts:{impersonationLevel=impersonate}!\\" &_
    strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Nico Mak Computing\WinZip\WinIni"
strValueName1 = "Setup"
strValueName2 = "win32_version"
strValueName3 = "Name"
strValueName4 = "SN"
strValueName5 = "UZQF"
StrValueName6 = "Name1"
StrValueName7 = "SN1"
oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strValueName1,Setup
oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strValueName2,win32_version
oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strValueName3,Name
oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strValueName4,SN
oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strValueName5,UZQF
oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strValueName6,Name1
oReg.GetStringValue _
   HKEY_LOCAL_MACHINE,strKeyPath,strValueName7,SN1

if isnull(Setup) then
  Setup = "missing"
end if

if isnull(win32_version) then
  win32_version = "missing"
end if

if isnull(Name) then
  Name = "missing"
end if

if isnull(SN) then
  SN = "missing"
end if

if isnull(UZQF) then
  UZQF = "missing"
end if

if isnull(Name1) then
  SN = "missing"
end if

if isnull(SN) then
  SN = "missing"
end if

 

'===================================================================================================================

'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. Here assumption is that the data class with below guid is already configured on server
dim objDCInstance
'Insert custom Data Class GUID here
set objDCInstance = nse.AddDataClass ("{6741a63d-8c48-428d-a7c0-54e3421e60f0 }")

dim objDataClass
set objDataClass = nse.AddDataBlock (objDCInstance)

'Add a new row
dim objDataRow
set objDataRow = objDataClass.AddRow
'Set columns
objDataRow.SetField 0, Setup
objDataRow.SetField 1, win32_version
objDataRow.SetField 2, Name
objDataRow.SetField 3, UZQF
objDataRow.SetField 3, SN
objDataRow.SetField 3, Name1
objDataRow.SetField 3, SN

nse.SendQueued

 

So, that's everything. Should be pretty simple, right? I have a feeling someone is going to point out one really obvious thing that I did wrong, and once corrected, everything should work. Well, I'm hoping at any rate...

Any help would be appreciated! Thank you,

Dustin

 


Viewing all articles
Browse latest Browse all 26913

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>