option explicit

const HKEY_CURRENT_USER = &H80000001
dim objShell, objDesktop,objLink
dim apppath, workdir, iconpath, shortcutname, arguments
dim computer,objReg, stdout
dim key1, key2, path2, valname2, val2
dim SetDWORDValue
dim strComputer,objWMIService,objOS,osInfo,isVista,OSVersion

isVista=FALSE
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set objOS = objWMIService.ExecQuery ("select * from Win32_OperatingSystem where Primary=true")

For Each osInfo in objOS
	osVersion=osInfo.Caption
	if instr(osVersion,"Vista") then isVista=TRUE
Next

if isVista=TRUE then
	If WScript.Arguments.length =0 Then
	  Set objShell = CreateObject("Shell.Application")
	  'Pass a bogus argument with leading blank space, say [ uac]
	  objShell.ShellExecute "wscript.exe", Chr(34) & _
	  WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
	Else
		configureIt
		wscript.echo osVersion & " - installation complete"
	End If
else
	configureIt
	wscript.echo osVersion & " - installation complete"
end if



sub configureIt()
	workdir="%HOMEDRIVE%%HOMEPATH%"
	apppath="c:\program files\Internet Explorer\iexplore.exe"
	arguments="https://vsa.kinetix.com/gethelp.asp"
	shortcutname="NBCSys Remote Support"
	iconpath="C:\Program Files\Internet Explorer\iexplore.exe,1"
	computer="."

	set objShell=CreateObject("WScript.Shell")
	objDesktop=objShell.SpecialFolders("Desktop")
	Set objLink = objShell.CreateShortcut(objDesktop & "\" & shortcutname & ".lnk")
	objLink.Description=shortcutname
	objLink.IconLocation=iconpath
	objLink.TargetPath=apppath
	objLink.Arguments=arguments
	objLink.WorkingDirectory=workdir
	objLink.Save

	key1="SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\kinetix.com"
	key2="SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\kinetix.com\vsa"
	path2="SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\kinetix.com\vsa"
	valname2="https"
	val2=2

	Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & computer & "\root\default:StdRegProv")
	objReg.CreateKey HKEY_CURRENT_USER,key1
	objReg.CreateKey HKEY_CURRENT_USER,key2
	objReg.SetDWORDValue HKEY_CURRENT_USER,path2,valname2,val2
end sub
