Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

collect input and put into WMIC command

$
0
0

So I am trying to make a mini program/script for the end user, me at this point, to input a computer name and get the results of the software that computer has on it.

I can do all of this in command prompt manually, however it looks like I lose the option if I put it in visual basic and add prompts.

Here is the code I am working with.

'Collect Computer Name
ComputerNode = InputBox( "Enter Computer Name:" )
Wscript.Echo ComputerNode
Set objShell = CreateObject("WScript.Shell")
'Get Software List
objShell.run "wmic /OUTPUT:c:\software.txt /node: ComputerNode product get name,version,vendor"
WScript.sleep 30000
objShell.run "c:\software.txt" 
SoftwareNode = InputBox( "Enter Software Name:" )
objShell.run "cmd /K wmic /node: ""ComputerNode"" product where name=""SoftwareNode"" call uninstall"

The issue appears that the wmic command is not translating the ComputerNode and SoftwareNode text for the objects they should represent. 

Does anyone know if this is even possible this way? I am open to other options, like powershell. I just know more about vbs, which still isn't much.


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>