Sign in to follow this  
Followers 0
laidback01

Converting Script from Technet

4 posts in this topic

Hey, I want to convert this script from M$ Technet:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
 
For Each objNetAdapter In colNetAdapters
    errEnable = objNetAdapter.EnableDHCP()
Next

Anyway, can someone else do it their way? See, what I'm doing, is trying to make sure I try it first, and I'll come back later for the answer!

Hopefully that makes sense.

thanks,

Jack

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hey, I want to convert this script from M$ Technet:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colNetAdapters = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
 
For Each objNetAdapter In colNetAdapters
    errEnable = objNetAdapter.EnableDHCP()
Next
First, put a dollar sign at the beginning of each variable name.

Second, remove every 'Set' command, as AutoIt doesn't use them.

Change GetObject() to ObjGet().

Take the word 'Each' out of the For/Next loop, AutoIt doesn't use it.

That should make it work. If you are still stuck, post your version and you'll get plenty of help.

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

First, put a dollar sign at the beginning of each variable name.

Second, remove every 'Set' command, as AutoIt doesn't use them.

Change GetObject() to ObjGet().

Take the word 'Each' out of the For/Next loop, AutoIt doesn't use it.

That should make it work. If you are still stuck, post your version and you'll get plenty of help.

:)

Heh, I just found out there is excellent documentation in the Scite Editor... Since I didn't see it on the website, I made the stupid assumption that there was no language ref or anything, and that I just just learn from others' code. Heh, life will go very well indeed now that I have printed off the 496 sheets of help file! Fantastic docs, thanks be to whomever did that!

Share this post


Link to post
Share on other sites

Heh, I just found out there is excellent documentation in the Scite Editor... Since I didn't see it on the website, I made the stupid assumption that there was no language ref or anything, and that I just just learn from others' code. Heh, life will go very well indeed now that I have printed off the 496 sheets of help file! Fantastic docs, thanks be to whomever did that!

Tree Killer!

Printed it out...?! Dude how... how... last millennium! :blink:

AutoIt ships with a very good help file (AutoIt3.chm). It is the complete language reference, contains a couple of introductory tutorials, and has example scripts for almost every function. Every time I sit down to AutoIt, I keep the help file open (on the index tab, since I usually know what I'm looking for) for reference.

But it never occurred to me to print it out! A new help file comes out with every production and beta version. AutoIt's development team is very active, so that's pretty often. It just doesn't make sense to try and keep an up-to-date hard copy around.

I'll bet you chopped down a real tree for Christmas too, didn't ya? :)

Merry Christmas anyway!

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0