The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ChillyWilly on January 31, 2010, 07:24:00 AM

Title: convert vbs to masm
Post by: ChillyWilly on January 31, 2010, 07:24:00 AM
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)
Title: Re: convert vbs to masm
Post by: donkey on January 31, 2010, 07:50:54 AM
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 ;)
Title: Re: convert vbs to masm
Post by: donkey on January 31, 2010, 08:30:35 AM
ToutEnMasm did an example here:

http://www.masm32.com/board/index.php?topic=8358.0
Title: Re: convert vbs to masm
Post by: 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:
Title: Re: convert vbs to masm
Post by: donkey on January 31, 2010, 06:34:31 PM
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
Title: Re: convert vbs to masm
Post by: GregL on January 31, 2010, 09:25:51 PM
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.
Title: Re: convert vbs to masm
Post by: ChillyWilly on January 31, 2010, 11:47:57 PM
i believe vista and windows7 both include a file called slmgr.vbs that will do such things , xp didnt include anything like that