Link to home
Start Free TrialLog in
Avatar of prologic08
prologic08

asked on

Need to convert a BAT to VBS, JS or PowerShell

I need to take a batch file that simply changes the license key in MS Office and convert it to something that will keep the license key contained so that nobody can view it..Meaning, it cannot extract the bat file, run it and delete the bat. I would need it to be fully self contained so that there is no way for an end user to view it.

cd\
c:
cd Program Files (x86)\Microsoft Office\Office14
cscript ospp.vbs /inpkey:11111-11111-11111-11111-11111
cscript ospp.vbs /act

Open in new window


My first attempt was a converting a bat to exe but the exe was just a self extracting file that ran and deleted the bat. This does not work for my needs.

Second attempt is using Advanced Installer to create an msi ran as administrator. I created a custom action that launches a file. The file to launch would be cscript ospp.vbs. the command line would be /inpkey:11111-11111-11111-11111-11111. and the working directory is C:\Program Files (x86)\Microsoft Office\Office14\.
This attempt returns an error: There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected.
I removed the check mark for: Fail installation if custom action returns an error.
Still didn't work..

So my next option is to do a Custom Action that Executes inline script code. This allows VBS or JS. I also have the option for PowerShell. So I would like to know if anyone can create me either a VBS, JS or PowerShell script that mimics the code above.
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of prologic08
prologic08

ASKER

Ha! You were right (obviously). Thanks!