# VBScript, passing variables, DOS, and browser



## atdt (Mar 24, 2009)

The use of this script is to get:

1. The computer name (hostname)
2. The computer model

and then through DOS it opens up a web broswer to go to the link http://..../something.php?hostname=<hostname here>&model=<model here>

So in a nut shell, if everything went correctly it should have tried to send:

http://.../something.php?hostname=LJ-890&model=Latitude D620

and the browser should be smart enough to insert a %20 where the space is,
the problem is that when I pass the model's variable to wshshell.run, the only thing I get is "Latitude" so it looks like this:

http://.../something.php?hostname=LJ-890&model=Latitude

Here is the script:

set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colOS = objWMI.InstancesOf("Win32_OperatingSystem")
for each objOS in colOS
hostname = objOS.CSName
next

set colCS = objWMI.InstancesOf("Win32_ComputerSystem")
for each objCS in colCS
model = objCS.Model
next

Set wshshell = WScript.CreateObject("WScript.Shell")
wshshell.run "http://10.16.202.15/test.php?hostname=" & hostname & "&model=" & model &""

Need help, thanks.


----------



## Squashman (Apr 14, 2005)

I believe you need 3 sets of double quotes around the whole URL.


----------



## atdt (Mar 24, 2009)

Squashman said:


> I believe you need 3 sets of double quotes around the whole URL.


"http://10.16.202.15/test.php?hostname=" & hostname & "&model=" & model &""

It looks like there already is 3 sets of double quotes. Unless the placement is wrong or something else I'm not aware of.


----------



## Squashman (Apr 14, 2005)

Reread my post above.


----------

