Menu vbscript avec interface

chriskalo1 Messages postés 10 Date d'inscription mardi 26 mai 2009 Statut Membre Dernière intervention 5 septembre 2012 - 5 sept. 2012 à 04:14
cs_hackoo Messages postés 91 Date d'inscription mercredi 3 avril 2002 Statut Membre Dernière intervention 29 juillet 2013 - 9 sept. 2012 à 15:12
slt les amis,
une foi d plus je viens avec un petit probleme et j aurai besoin de votre aide!
voila je un vbscript qui install certains programmes seulement mn boss veut que je fasse un menu avec un interface pour le scrip afin de pouvoir choisir quel programme je voudrais installer sur une machine d utilisateur.
"genre menu d installation" voila le code:
qulqu'un p m aider a faire le menu de pr ce script ou avec un script de menu deja pret pour adapter!?
Dim oShell
Set oShell = CreateObject("WScript.Shell")
Set WS = CreateObject("WScript.Shell")
Set ED = CreateObject("Scripting.FileSystemObject")
Userprofile = ws.ExpandEnvironmentStrings("%Userprofile%")
arqPro = ws.ExpandEnvironmentStrings("%PROGRAMFILES%")
windir = ws.ExpandEnvironmentStrings("%windir%")
COMPUTERNAME = ws.ExpandEnvironmentStrings("%computername%")
Allusersprofile = ws.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
dir_logon = "\\10.85.64.3\logins\usuarios_logados"
firefox = arqPro & "\Mozilla Firefox\firefox.exe"
firefoxversion = "7.0.1"
java = arqPro & "\Java\jre7\bin\java.exe"
javaversion = "7.0.0"
reader = arqPro & "\Adobe\Reader 10.0\Reader\AcroRd32.exe"
ocs = arqPro & "\OCS Inventory Agent\Ocs_contact.exe"
tightvnc = arqPro & "\TightVNC\WinVNC.exe"
ccleaner = arqPro & "\CCleaner\CCleaner.exe"
flash = windir & "\system32\Macromed\Flash\FlashUtil10w_ActiveX.exe"
flashversion = "10.3"
msg = "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\msg.vbs"
Msg_TF = false

'escrevendo no arquivo install para manter o loop até que finalize a instalação dos programas
if ED.FileExists(dir_logon&computername&" install.txt") then
Set objTextFile = ED.OpenTextFile (dir_logon&computername&" install.txt", 2, True)
objTextFile.WriteLine(userprofile)
objTextFile.Close
end if

'Alteração de registros para bloqueio de papel de parede, e diretivas de proxy
WS.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\SYSTEM\WALLPAPER" , "%USERPROFILE%\wallpaper.bmp"
WS.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\SYSTEM\WALLPAPER STYLE" , "0", "REG_DWORD"
WS.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop\NoChangingWallPaper" , "1", "REG_DWORD"
WS.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableTaskMgr" , "1", "REG_DWORD"
WS.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Control Panel\Proxy" , "1", "REG_DWORD"

WS.RegWrite "HKEY_LOCAL_MACHINE\software\Microsoft\Internet Explorer\Main\Start Page", "http://www.pge.go.gov.br"
WS.RegWrite "HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable", "1", "REG_DWORD"
WS.RegWrite "HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyOverride", "localhost;10.85.64.0/19"
WS.RegWrite "HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer", "proxy.intra.goias.gov.br:2303"

If ED.FolderExists ("c:\Install") then
ED.DeleteFolder("c:\Install")
ED.CreateFolder("c:\Install")
else
ED.CreateFolder("c:\Install")
end if

If ED.FileExists(firefox) Then
version = ED.GetFileVersion(firefox)
if instr (version, firefoxversion) = 0 then
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\firefox.exe", "c:\Install\firefox.exe"
Msg_TF = true
end if
else
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\firefox.exe", "c:\Install\firefox.exe"
Msg_TF = true
end if

'If ED.FileExists(java) Then
'	version = ED.GetFileVersion(java)
'	if instr (version, javaversion) = 0 then
'		ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\java.exe", "c:\Install\java.exe"
'	end if
'else
'	ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\java.exe", "c:\Install\java.exe"
'end if

If ED.FileExists(flash) Then
version = ED.GetFileVersion(flash)
if instr (version, flashversion) = 0 then
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\flash.msi", "c:\Install\flash.msi"
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\flash_ex.msi", "c:\Install\flash_ex.msi"
Msg_TF = true
end if
else
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\flash.msi", "c:\Install\flash.msi"
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\flash_ex.msi", "c:\Install\flash_ex.msi"
Msg_TF = true
end if

'If not ED.FileExists(reader) Then
'	ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\reader.exe", "c:\Install\reader.exe"
'	Msg_TF = true
'end if

If not ED.FileExists(ocs) Then
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\ocs.exe", "c:\Install\ocs.exe"
Msg_TF = true
end if

If not ED.FileExists(tightvnc) Then
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\tightvnc.exe", "c:\Install\tightvnc.exe"
Msg_TF = true
end if
If not ED.FileExists(ccleaner) Then
ED.CopyFile "\\10.85.64.3\bkpdata\sistemas\NETInstaladores\ccleaner.exe", "c:\Install\ccleaner.exe"
Msg_TF = true
end if

'--------msg de atualização--------


If Msg_TF Then
ED.CopyFile msg, "c:\Install\msg.vbs"
WS.Run "c:\Install\msg.vbs", 1 ,false
end if

'*******************End Of Code**************
If ED.FileExists("c:\Install\Firefox.exe") Then
oShell.Run """c:\Install\Firefox.exe"" /S", 1 ,True
end if
If ED.FileExists("c:\Install\java.exe") Then
oShell.Run """c:\Install\java.exe"" /s /v ""/qn ADDLOCAL=ALL IEXPLORER=1 MOZILLA=1", 1 ,True
end if
If ED.FileExists("c:\Install\reader.exe") Then
oShell.Run """c:\Install\reader.exe"" /sAll /rs /l", 1 ,True
end if
If ED.FileExists("c:\Install\ocs.exe") Then
oShell.Run """c:\Install\ocs.exe"" /S /SERVER:10.85.64.4 /PROXY_TYPE=0 /NO_SYSTRAY /SSL=0 NOSPLASH /DEBUG=2 /NOW", 1 ,True
end if
If ED.FileExists("c:\Install\tightvnc.exe") Then
oShell.Run """c:\Install\tightvnc.exe"" /ss- /verysilent", 1 ,True
end if
If ED.FileExists("c:\Install\ccleaner.exe") Then
oShell.Run """c:\Install\ccleaner.exe"" /S /AUTO", 1 ,True
end if
If ED.FileExists("c:\Install\flash.msi") Then
oShell.Run """c:\Install\flash.msi"" /quiet", 1 ,True
end if
If ED.FileExists("c:\Install\flash_ex.msi") Then
oShell.Run """c:\Install\flash_ex.msi"" /quiet", 1 ,True
end if

Wscript.Sleep 500
If ED.FolderExists ("c:\Install") then
ED.DeleteFolder("c:\Install")
end if

'WScript.Echo "Instalação completa"
if ED.FileExists(dir_logon&computername&" install.txt") then
'msgbox ("Deletando arquivo install")
ED.DeleteFile (dir_logon&computername&" install.txt")
end if
Set oShell = Nothing



'*******************End Of Code**************




1 réponse

cs_hackoo Messages postés 91 Date d'inscription mercredi 3 avril 2002 Statut Membre Dernière intervention 29 juillet 2013
9 sept. 2012 à 15:12
Salut!
Inspirez-vous de cet exemple : EXEMPLE DE MENU EN HTA AVEC PASSWORD ET LIMITE DE NOMBRE D'ESSAIS
et vous pouvez juste prendre la partie qui vous conviendrez mieux càd la procédure du Menu principal sans passer par le mot de passe
0
Rejoignez-nous