Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

installing softwar

Status
Not open for further replies.

deltsigjoe

IS-IT--Management
Apr 12, 2011
16
US
thread329-1221834

Hello All,
I am installing some software with a vbscript. I have been working on an XP machine and it works great. When I tried it on a Win7 machine, the script did not work... I modified the script to work on Win7 and it worked great, but now the script will not run on the XP machine. It is basically a one liner to correct the versions.

Since I have half and half (winxp and win7) computers in my environment, is there a way to detect either WinXP or Win7 and run that line of code for the correct OS?
 
the computer's registry

Code:
CONST HKEY_LOCAL_MACHINE  = &H80000002
CONST WINDOWS_XP          = "Microsoft Windows XP"

strComputer = "."
set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", strComputerOS

if (strComputerOS = WINDOWS_XP) then
    'Run the XP version
else
    'Run the other version
end if

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
thank you so much...

it seems to have done the trick, but now I come with another problem...Error Code 800A03EA Syntax ERROR
When it goes to the Win7 version of the code, I get an error at the following line: (on the p character 22)

cmd = "MSIEXEC /i "\\petu.edu\installs\App-V\setup.msi"

any suggestion would greatly be appreciated.
 
the line only has 3 quotes, you need on more. What's more, quotes inside quotes need to be delimited with a quote so you actually need 3 more.

cmd = "MSIEXEC /i "\\petu.edu\installs\App-V\setup.msi"

should be

cmd = "MSIEXEC /i [red]"[/red]"\\petu.edu\installs\App-V\setup.msi[red]""[/red]"

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
I'm kind of confused with all of the double quotes.
Here is the exact line of code I have for XP that is working fine:

cmd = "MSIEXEC /i " & Chr(34) & "\\petu.edu\installs\App-V\setup.msi" & Chr(34) & " INSTALLDIR=" & Chr(34) & "C:\Program Files\Softricity\SoftGrid for Windows Desktops" & Chr(34) & " SWICACHESIZE=" & Chr(34) & "8192" & Chr(34) & " SWIDCSDISPLAY=" & Chr(34) & "UTEP-AppV" & Chr(34) & " SWIPUBSVRHOST=" & Chr(34) & "appvpro.utep.edu" & Chr(34) & " SWIPUBSVRREFRESH=" & Chr(34) & "on" & Chr(34) & " SWIPUBSVRPATH=" & Chr(34) & "/" & Chr(34) & " SWIPUBSVRTYPE=" & Chr(34) & "RTSP" & Chr(34) & " SWIFSDRIVE=" & Chr(34) & "Q" & Chr(34) & " SWIPUBSVRPORT=" & Chr(34) & "554" & Chr(34) & " SWISKIPDATASETTINGS=" & Chr(34) & "True" & Chr(34) & " /passive /forcerestart /l*v c:\appv.log"



Here is the line of code I have for Win7 that is not working:

cmd = "MSIEXEC.exe /i "\\petu.edu\installs\App-V\setup.msi" INSTALLDIR="C:\Program Files\Softricity\SoftGrid for Windows Desktops" SWICACHESIZE="8192" SWIDCSDISPLAY="UTEP-AppV" SWIPUBSVRHOST="appvpro.utep.edu" SWIPUBSVRREFRESH="on" SWIPUBSVRPATH="/" SWIPUBSVRTYPE="RTSP" SWIFSDRIVE="Q" SWIPUBSVRPORT="554" SWISKIPDATASETTINGS="True" /passive /forcerestart /l*v c:\appv.log"

if I am understanding correctly, every quote has to be wrapped in 1 set of double quotes??
 
The quotes can be confusing, especially because it is also the escape character. Substituting CHR(34) for a quote is fine because character 34 is a quote ("). Essentially, change all the " in the line to "" - except for the first and last quote.

Code:
cmd = "import.vbs "C:\data\import.dat"
evaluates to [import.vbs ]

cmd = "import.vbs [red]"[/red]"C:\data\import.dat[red]"[/red]"
evaluates to [import.vbs "C:\data\import.dat"]

Escape a quote to tell the compiler to "by-pass" it.

cmd = "MSIEXEC.exe /i [red]"[/red]"\\petu.edu\installs\App-V\setup.msi[red]"[/red]" INSTALLDIR=[red]"[/red]"C:\Program Files\Softricity\SoftGrid for Windows Desktops[red]"[/red]" SWICACHESIZE=[red]"[/red]"8192[red]"[/red]" SWIDCSDISPLAY=[red]"[/red]"UTEP-AppV[red]"[/red]" SWIPUBSVRHOST=[red]"[/red]"appvpro.utep.edu[red]"[/red]" SWIPUBSVRREFRESH=[red]"[/red]"on[red]"[/red]" SWIPUBSVRPATH=[red]"[/red]"/[red]"[/red]" SWIPUBSVRTYPE=[red]"[/red]"RTSP[red]"[/red]" SWIFSDRIVE=[red]"[/red]"Q[red]"[/red]" SWIPUBSVRPORT=[red]"[/red]"554[red]"[/red]" SWISKIPDATASETTINGS=[red]"[/red]"True[red]"[/red]" /passive /forcerestart /l*v c:\appv.log"

-Geates

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live."
- Martin Golding

"There are seldom good technological solutions to behavioral problems."
- Ed Crowley, Exchange guru and technology curmudgeon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top