need vbs to check for registry path/key exists
Hello all,
i need a vbscript that should run against all the machines in my network we are using sccm and check for a registry path/key and result should be written to excel file with the host name and result of search. Let me also know if i can do this in SCCM in any other way.
thanks in advance
i need a vbscript that should run against all the machines in my network we are using sccm and check for a registry path/key and result should be written to excel file with the host name and result of search. Let me also know if i can do this in SCCM in any other way.
thanks in advance
0 Comments
[ + ] Show comments
Answers (5)
Please log in to answer
Posted by:
andys0123
12 years ago
Create a VBScript using the RegRead function of a Shell object to check for the registry key/value and which writes to a CSV formatted TextFile using a FileSystemObject.
Using RegRead, if you are checking for a key, add a "\" at the end of the key path e.g. 'strVal = oShell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CTF\")' . Check the value of the error returned - it will be >0 for a non valid key/value (remember the 'on error resume next' at the start of the script).
For the log, start each line with 'CHR(34) & ' to start with a double quote, and then add ' & CHR(34) & "," & CHR(34)' between each column to add the delimiters, End with ' & CHR(34) '. The file should the open in Excel with each column
Call the script from an advertised programm in SCCM and link to collection with all machines required.
Using RegRead, if you are checking for a key, add a "\" at the end of the key path e.g. 'strVal = oShell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CTF\")' . Check the value of the error returned - it will be >0 for a non valid key/value (remember the 'on error resume next' at the start of the script).
For the log, start each line with 'CHR(34) & ' to start with a double quote, and then add ' & CHR(34) & "," & CHR(34)' between each column to add the delimiters, End with ' & CHR(34) '. The file should the open in Excel with each column
Call the script from an advertised programm in SCCM and link to collection with all machines required.
Posted by:
anonymous_9363
12 years ago
If you're expecting someone to post a script for you to use, I'd say you're straight out of luck. Building a script to do this job with any resilience is a non-trivial undertaking and most people who respond to posts work full-time. I wouldnt imagine any of them will provide you with code for free.
My advice would be to find a script which reads the registry value in question, find another which shows you how to programmatically populate an Excel spreadsheet and then marry the two together. Search AppDeploy for the text 'computerperformance'. That will turn up a number of posts with links to various web sites with scripts available for download.
My advice would be to find a script which reads the registry value in question, find another which shows you how to programmatically populate an Excel spreadsheet and then marry the two together. Search AppDeploy for the text 'computerperformance'. That will turn up a number of posts with links to various web sites with scripts available for download.
Posted by:
mahendraKumar
12 years ago
Posted by:
acbabu
12 years ago
Mahendra i am looking for HKLM reg key which is for internal use and every user should need that key so checking out for a script which looks in to each machine for the regpath and reports the results as yes/no
ORIGINAL: mahendraKumar
what you want to check in Machines.. Please be more detailed on your needs..
whether it is HKCU or HKLM regkeys
whether you are going to generate report on applications installed in the target machines...
Posted by:
acbabu
12 years ago
Thanks Andy i am trying out writing the script
ORIGINAL: andys0123
Create a VBScript using the RegRead function of a Shell object to check for the registry key/value and which writes to a CSV formatted TextFile using a FileSystemObject.
Using RegRead, if you are checking for a key, add a "\" at the end of the key path e.g. 'strVal = oShell.regread("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CTF\")' . Check the value of the error returned - it will be >0 for a non valid key/value (remember the 'on error resume next' at the start of the script).
For the log, start each line with 'CHR(34) & ' to start with a double quote, and then add ' & CHR(34) & "," & CHR(34)' between each column to add the delimiters, End with ' & CHR(34) '. The file should the open in Excel with each column
Call the script from an advertised programm in SCCM and link to collection with all machines required.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.