B4J Question Execute VBS script on windows and get returned value?

Nokia

Active Member
Licensed User
Longtime User
I am trying to figure a way to lock down my license for my app on to a node/computer so they can’t move from computer to computer.

What is normally done in the B4J world?

I have a vbs script that I have modified to return a machine ID…

B4X:
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
strD = ""
strP = ""
strN = ""
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk Where DeviceID = 'C:'")
For Each objItem In colItems
  strD = objItem.VolumeSerialNumber
Next
Set colItemsP = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem In colItemsP
  strP = strP & objItem.ProcessorID & "::"
Next
Set colItemsN = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objItem In colItemsN
  strN = objItem.Name
Next

Is there a way to write this code to a .vbs file and execute it and get returned value then delete the file?

I can also put this in s vb.net .dll file and have seen somewhere on here about making a bridge to native .net software..
 

billzhan

Active Member
Licensed User
Longtime User
Maybe it's possible to execute the script with jShell lib, and the results are written to a file by the script.
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Please find attached a tested example (B4J on windows 10) using the jShell Library. The WSH script test1.vbs is located in the project objects folder.
 

Attachments

  • B4JHowToShellWSH.zip
    3.2 KB · Views: 250
Upvote 0

Nokia

Active Member
Licensed User
Longtime User
Please find attached a tested example (B4J on windows 10) using the jShell Library. The WSH script test1.vbs is located in the project objects folder.

this looks good.. Thanks..

I was looking at the jshell, just didn't know how to do it..

does this write the results back to a file or catch it in memory?
 
Upvote 0
Top