News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

convert vbs to masm

Started by ChillyWilly, January 31, 2010, 07:24:00 AM

Previous topic - Next topic

ChillyWilly

is something like this possible to convert to masm?
Dim VOL_PROD_KEY
VOL_PROD_KEY = Wscript.arguments.Item(0)
VOL_PROD_KEY = Replace(VOL_PROD_KEY,"-","") 'remove hyphens if any

for each Obj in GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf ("win32_WindowsProductActivation")

   result = Obj.SetProductKey (VOL_PROD_KEY)

donkey

Yes, it is a WMI interface, you'll find a few examples of how to use them on the board. Its going to look a lot more complicated than that script though ;)
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

donkey

"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

ChillyWilly

wow my head is spinning with that one  :dazzled:
i think i might be better off shellexecuting that script  :dance:

donkey

Quote from: ChillyWilly on January 31, 2010, 04:08:28 PM
wow my head is spinning with that one  :dazzled:
i think i might be better off shellexecuting that script  :dance:

You can execute the script from MASM, I saw an example by Ernie once that executed VB script. I think it used to be in the MASM32 distribution, Hutch would probably still have a copy of it somewhere. Its a pretty good way to attack the problem, though I would probably choose the WMI route but then I'm a bit of a masochist.

Edgar
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

GregL

ChillyWilly,

After reading your post I thought I would check out the Win32_WindowsProductActivation class. I couldn't find that class on my system. I did a search and found out the following.

Quote
Question:  Has the Win32_WindowsProductActivation class been removed from Windows Vista? I have a script that I use to activate Windows, but that script no longer works on Windows Vista.

-- HM

Answer:  Hello HM, The Win32_WindowsProductActivation class has been removed from Windows Vista. Instead, you need to use these two classes seen here:

SoftwareLicensingService

SoftwareLicensingProduct

Both WMI classes are found in the Root\Cimv2 WMI namespace.

From the 'Hey, Scripting Guy! Blog'

It's the same situation for Windows 7.  I just thought I'd let you know.

ChillyWilly

i believe vista and windows7 both include a file called slmgr.vbs that will do such things , xp didnt include anything like that