Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

NS7 Custom Inventory VBScript - 32 & 64-bit Add/Remove Programs Registry Data

Created: 31 Aug 2009 | 11 comments
dougj's picture
+2 2 Votes
Login to vote

This custom inventory is in NS7 format. It retrieves Add/Remove Programs data from both the 32 and 64-bit Windows registry locations. It does NOT filter out any results whatsoever. Optionally, it has commented vbscript statements to display the results on-screen in case a user wants to view the results prior to loading them to the NS database. (In this case, please comment out the line that reads: "nse.SendQueued".)

This script requires the creation of a custom inventory data class on the NS server, as explained elsewhere on Connect. 

Comments 11 CommentsJump to latest comment

sscheube's picture

Hi there,

I have tried to implement this script which I guess is the same as the one in the KB Article 48241 (https://kb.altiris.com/article.asp?article=48241&p=1) and I have some problem with it. It works fine on 32bit computers. And it also works on 64bit computers when it is running in the 32bit mode. However if it is running in the 32bit mode then it cannot collect the 64bit Add Remove information which is the whole point. I understood that I should select "Enable launch 64-bit process" in the Advance Option of the Custom Inventory Job. But if I do that the I get the following error message:

Error: Could not create object named "Altiris.AeXNSEvent".
Source: Wscript.CreateObject

Have you seen this problem before? Is there anything else I should check when implementing this in Altiris NS 7?

Stefan

0
Login to vote
rpoag's picture

I have had this problem and never figured out a simple workaround.  When you run a 64 bit script you cannot instantiate a 32-bit object or at least the 32 bit Altiris object.  There is probably a way to write what you need to file, launch another 32 bit vbscript to parse the file, call the object, and submit the inventory but that was a last resort for me and I never made it that far in testing.  You might be able to make it work if you hard code the path to the DLL but then I think you have to make the function call differently as well.

Ryan Poag
Northrop Grumman
If your question has been resolved, please be sure to "Mark as Solution"! Thank you.

0
Login to vote
sscheube's picture

My colleague found the following which seems to work. Here just an example which can be adapted to retrieve all the information from the registry and then using the same method as above to fill up the Custom Inventory.

The next question is how I can "randomize" the Task / Job because I don't want that the task run on all clients at the same time




Const HKEY_LOCAL_MACHINE = &H80000002 sPath = ReadRegStr (HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\ASP.NET\2.0.50727.0", "Path", 64) WScript.Echo sPath ' Reads a REG_SZ value from the local computer's registry using WMI. ' Parameters: '   RootKey - The registry hive (see http://msdn.microsoft.com/en-us/library/aa390788(VS.85).aspx for a list of possible values). '   Key - The key that contains the desired value. '   Value - The value that you want to get. '   RegType - The registry bitness: 32 or 64. ' Function ReadRegStr (RootKey, Key, Value, RegType)     Dim oCtx, oLocator, oReg, oInParams, oOutParams     Set oCtx = CreateObject("WbemScripting.SWbemNamedValueSet")     oCtx.Add "__ProviderArchitecture", RegType     Set oLocator = CreateObject("Wbemscripting.SWbemLocator")     Set oReg = oLocator.ConnectServer("", "root\default", "", "", , , , oCtx).Get("StdRegProv")     Set oInParams = oReg.Methods_("GetStringValue").InParameters     oInParams.hDefKey = RootKey     oInParams.sSubKeyName = Key     oInParams.sValueName = Value     Set oOutParams = oReg.ExecMethod_("GetStringValue", oInParams, , oCtx)     ReadRegStr = oOutParams.sValue End Function
+1
Login to vote
rpoag's picture

Why not put a random wait into your script?  Seems like the easiest way.  That way you have some control over how many minutes or hours you have the inventory wait to run.

Ryan Poag
Northrop Grumman
If your question has been resolved, please be sure to "Mark as Solution"! Thank you.

0
Login to vote
sscheube's picture

Yeah this would be an option however you then have a wscript.exe process running in the background using up some resources... I was looking for something similar like it is possible in the Inventory Solution. There you can set to "Throttle inventory reporting evenly over a period of  and then choose a time frame:

Maybe I can see if I could "reuse" the inventory policy...
 

0
Login to vote
Kada's picture

In our company we are using two vbs scripts for gathering informations from registry on 64 bit OS. First script is triggered with option "Enable launch 64bit process" and copy needed registry to Wow6432Node. Second script is gathering the registry from Wow6432Node and sending by Altiris 32bit object to NS by NSE.

0
Login to vote
jcd78's picture

Hi Kada,

I'm really interested by the script you are using to copy all the registry you want to gather to wow6432node.

I try many vbs script (with regread and regwrite) with the "enable launch 64 bits" option enabled . But the agent seems to still using the wrong version of cscript.

Thanks

JC

0
Login to vote
woofer50's picture

Hi Doug and thanks for sharing this app - it's just what I was looking for (even though I had to script another app to filter the results, you still saved me a lot of time)!

0
Login to vote
Atulya Tiwari's picture

Hi friends,

       i am looking for a script to fetch the MS office product keys from Office XP/2003/2007/2010 i created one VBscript and run it but i can get only office 2007 cd keys not others can you please help me on it..........

Atulya K Tiwari

Tech Support - Product & Services

0
Login to vote
Abhi_U's picture

 I am looking for a script to retieve the MS office product keys from Office XP/2003/2007/2010/2013 and Windows XP/2003/2008/2008 R2/VISTA/7/8. Please help me on it..........

0
Login to vote
Abhi_U's picture

I am looking for software changes report in Altirsi NS 7.1 SP2. Please help me on it.....

0
Login to vote