473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

vbs script not working the way i hopped in vb.net

Hello Everyone,

I have a VBS script that allows me to do a recursive search through a specific registry key to find a key value in multiple of the key directories. And unfortunately it dosn't want to work properly with vb.net in my visual studio even when i try to make the syntax changes, any help would be awsome.
Note: Help on getting this to show the Binary value aswell would be helpful.


Const numRoot = &H80000002
Const strRoot = "HKEY_LOCAL_MACHINE"
Const myRoot = "SOFTWARE\Microsoft"

Dim strComputer,strKey,objReg,myShell
strComputer = "."
Set myShell=CreateObject("WScript.Shell")

Set objReg=GetObject("winmgmts:{impersonationLevel=imp ersonate}!\\" & strComputer & "\root\default:StdRegProv")

strKey = myRoot

MyEnum strKey, objReg, myShell, strRoot, numRoot

Sub MyEnum(strKey,objReg,myShell, strRoot, numRoot)
Dim subKey,arrsubKeys,arrValues,keyValue,keyValueData
'dim Digits(23)
objReg.EnumValues numRoot, strKey, arrValues
If VarType(arrValues)=8204 Then
For Each keyValue in arrValues
keyValueData="REG_FULL_RESOURCE_DESCRIPTOR"
On Error Resume Next
keyValueData=myShell.RegRead(strRoot & "\" & strKey & "\" & keyValue)
On Error Goto 0
If VarType(keyValueData) = 8204 Then
keyValueData=Join(keyValueData,",")
End If
if keyValue="DigitalProductID" then
WScript.Echo strKey & "\" & keyValue & ":=" & keyValueData '&
end if
Next
End If


objReg.EnumKey numRoot, strKey, arrsubKeys
If VarType(arrsubKeys)=8204 Then
For Each subKey in arrsubKeys
'Wscript.Echo strKey & "\" & subKey
If strKey="" Then
MyEnum subKey , objReg, myShell, strRoot, numRoot
Else
MyEnum strKey & "\" & subKey , objReg, myShell, strRoot, numRoot
End If
Next

End If
End Sub


Thanks in advance.
gcasella

(Note: i already have the proper references for the wmi scripting)
Oct 2 '09 #1
0 936

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Flynn | last post by:
My understanding of javascript is very limited. Could some one help me out. I found this code for an image gallery viewer. It works fine on my site, but I'd like to modify it so that the mainpic...
2
by: Nasir Wasim | last post by:
How can Access DIV Properties in Script while using Netscape 7.2. I want to use the div id with it's Visibility and left propertyin script but it's not working :-( Main File : ----------- ...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
1
by: Q1tum | last post by:
Hi all, I have a problem with my script, I'm using javascript DOM to update my page. The getPortals() function updates a select list whichs shows portals. The doUpdate() function updates a...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
2
by: Tereska | last post by:
I want to delete script added before. I'm adding script dynamically and i'm removing later. Why it is still working? I have something like this: <html> <head> <title>JS Script...
9
by: whitgurley | last post by:
I've searched the web as well as I can for a solution to this problem but have found nothing and just don't know enough about JavaScript to figure out what's going. What I'm trying to do is convert...
9
by: Jerim79 | last post by:
Here it is: <?php if($_SERVER=='POST'){ $Number=$_POST; $Email=$_POST; $Number2=0; $error=0;
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.