473,412 Members | 2,003 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,412 software developers and data experts.

Convert Script code to VB.Net

Given a script like the following is there a recipe I could use to convert
it to VB.net code.'myServer = "."'The following moniker identifies the
root\cimv2 namespace on the myServer computer. An SWbemServices object is
returned.'objWMIService = GetObject("winmgmts:\\" & myServer &
"\root\cimv2")'colItems = objWMIService.ExecQuery("Select * from
Win32_Processor")'For Each objItem In colItems' Wscript.Echo("Processor Id:
" & objItem.ProcessorId)' Wscript.Echo("Maximum Clock Speed: " &
objItem.MaxClockSpeed)'NextI tried the following but don't really know why
it works.The parameter for GetObject is a path name to a file.What does the
path I used point to?Dim strComputer As String = "."Dim objWMIService As
Object = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Dim colItems
As Object = objWMIService.ExecQuery("Select * from Win32_Processor")For Each
objItem As Object In colItemsConsole.WriteLine("Processor Id: " &
objItem.ProcessorId)Console.WriteLine("Maximum Clock Speed: " &
objItem.MaxClockSpeed)NextInstead of Object are there .Net types that can be
used for this script?In general, given a script how does one determine the
types to use?I know I'm asking for a lot and I'd be appreciative for partial
answers or any help at all.Thanks
Mar 6 '06 #1
3 7004
I've no idea what happed to the previous post.
Here it is again.

Given a script like the following is there a recipe I could use to convert
it to VB.net code.

'myServer = "."
'objWMIService = GetObject("winmgmts:\\" & myServer &
"\root\cimv2")
'colItems = objWMIService.ExecQuery("Select * from
Win32_Processor")
'For Each objItem In colItems' Wscript.Echo("Processor Id:
" & objItem.ProcessorId)' Wscript.Echo("Maximum Clock Speed: " &
objItem.MaxClockSpeed)
'Next

I tried the following but don't really know why it works.
The parameter for GetObject is a path name to a file.What does the
path I used point to?

Dim strComputer As String = "."Dim objWMIService As
Object = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Dim colItems As Object =
objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem As Object In colItemsConsole.
WriteLine("Processor Id: " &
objItem.ProcessorId)Console.
WriteLine("Maximum Clock Speed: " &
objItem.MaxClockSpeed)
Next

Instead of Object are there .Net types that can be
used for this script?In general, given a script how does one determine the
types to use?

I know I'm asking for a lot and I'd be appreciative for partial
answers or any help at all.Thanks

Mar 6 '06 #2
Allen,

See this link on our website.
I thought that it is almost what your want.

http://www.vb-tips.com/default.aspx?...e-111ae0c748f2

There are more WMI tips search for that just on WMI

I hope this helps,

Cor

"Allen" <al***********@a-znet.com> schreef in bericht
news:%2***************@TK2MSFTNGP12.phx.gbl...
I've no idea what happed to the previous post.
Here it is again.

Given a script like the following is there a recipe I could use to convert
it to VB.net code.

'myServer = "."
'objWMIService = GetObject("winmgmts:\\" & myServer &
"\root\cimv2")
'colItems = objWMIService.ExecQuery("Select * from
Win32_Processor")
'For Each objItem In colItems' Wscript.Echo("Processor Id:
" & objItem.ProcessorId)' Wscript.Echo("Maximum Clock Speed: " &
objItem.MaxClockSpeed)
'Next

I tried the following but don't really know why it works.
The parameter for GetObject is a path name to a file.What does the
path I used point to?

Dim strComputer As String = "."Dim objWMIService As
Object = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Dim colItems As Object =
objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem As Object In colItemsConsole.
WriteLine("Processor Id: " &
objItem.ProcessorId)Console.
WriteLine("Maximum Clock Speed: " &
objItem.MaxClockSpeed)
Next

Instead of Object are there .Net types that can be
used for this script?In general, given a script how does one determine the
types to use?

I know I'm asking for a lot and I'd be appreciative for partial
answers or any help at all.Thanks

Mar 6 '06 #3
You never had to use
Dim objWMIService As Object = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
Do you know what that does?
Nice site
Thanks
"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
Allen,

See this link on our website.
I thought that it is almost what your want.

http://www.vb-tips.com/default.aspx?...e-111ae0c748f2

There are more WMI tips search for that just on WMI

I hope this helps,

Cor

"Allen" <al***********@a-znet.com> schreef in bericht
news:%2***************@TK2MSFTNGP12.phx.gbl...
I've no idea what happed to the previous post.
Here it is again.

Given a script like the following is there a recipe I could use to
convert
it to VB.net code.

'myServer = "."
'objWMIService = GetObject("winmgmts:\\" & myServer &
"\root\cimv2")
'colItems = objWMIService.ExecQuery("Select * from
Win32_Processor")
'For Each objItem In colItems' Wscript.Echo("Processor Id:
" & objItem.ProcessorId)' Wscript.Echo("Maximum Clock Speed: " &
objItem.MaxClockSpeed)
'Next

I tried the following but don't really know why it works.
The parameter for GetObject is a path name to a file.What does the
path I used point to?

Dim strComputer As String = "."Dim objWMIService As
Object = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Dim colItems As Object =
objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem As Object In colItemsConsole.
WriteLine("Processor Id: " &
objItem.ProcessorId)Console.
WriteLine("Maximum Clock Speed: " &
objItem.MaxClockSpeed)
Next

Instead of Object are there .Net types that can be
used for this script?In general, given a script how does one determine
the
types to use?

I know I'm asking for a lot and I'd be appreciative for partial
answers or any help at all.Thanks


Mar 6 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Andrew V. Romero | last post by:
At work we have an excel file that contains the list of medications and their corresponding strengths. I would like to save the excel file as a text list and paste this list into a javascript...
4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
4
by: D Newsham | last post by:
Hi, This javascript creates a table that has a header and side column that do not move while scrolling through the table. I need to convert this to vb script. Can anybody help, or do you have...
2
by: davidgordon | last post by:
Hi, I have some pages with this VBScript code, which obviously does not work in Firefox. How can I convert this to Javascript in order for my web page to work in Firefox ? It basically fills a...
3
by: Thubaiti | last post by:
Hi, I have this code in my ASP.NET and I want to convert it to C# (code behind) <asp:Repeater id="subCategoryRepeater" runat="server"> <ItemTemplate> <ul> <li> <asp:HyperLink...
6
by: Justin | last post by:
Hi all, i need some help over here... i found the solution to export file from mysql db into *.csv. but is there anyway to convert the contents into *.doc and save in my webserver and providing a...
4
by: donpro | last post by:
Hi, I've created a table where the header columns link to an AJAX function which calls a PHP file and returns content - the purpose is to sort the table on the heading. The code snippet is:...
9
by: ballygowanboy | last post by:
ok, so i've my front end shop code almost working, the quantity and price all add up........ now i need to add a curency conversion function, euro (default), dollar, and uk pound. right, i'm not...
15
by: Steve | last post by:
I am having problems getting values out of an array. The array is set as a global array and values are pushed into it as they are read from a JSON file using a "for loop". When the "for loop" is...
1
by: Tjwapa | last post by:
How do i convert a column with id letters in a file to a number 1 or 0 in coldfusion output....for example 'CON' or 'BUS' to be converted to an output of '0'and '1' (0 to represent CON and 1 for...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.