Asp : executer VBscript côté client??

Résolu
youp49 Messages postés 15 Date d'inscription dimanche 29 août 2004 Statut Membre Dernière intervention 31 décembre 2004 - 29 août 2004 à 15:08
youp49 Messages postés 15 Date d'inscription dimanche 29 août 2004 Statut Membre Dernière intervention 31 décembre 2004 - 30 août 2004 à 19:02
Salut,

J'ai fais un script VB qui me permet de récupérer les informations d'une machine pour faire un inventaire (IP, infos processeur, infos carte vidéo, résolution, ...).

Quand je suis passé sur un serveur distant et que j'ai executé le script j'ai eu les informations du serveur!

Donc j'ai vu que ce script ne s'executait pas côté client et je voudrais savoir si c'est possible??

Merci

3 réponses

TheEwook Messages postés 155 Date d'inscription samedi 3 juillet 2004 Statut Membre Dernière intervention 30 mai 2005
29 août 2004 à 18:11
Salut,

Ben ca depend qu'elle est ton script ?
Tu utilises le WMI pour récupérer tes infos ?

Sinon en utilisant le WMI, il y a aucun problème.
Dis moi ce que tu veux excatement et quel est ton script actuel ?

@++

________________
TheEwook
3
youp49 Messages postés 15 Date d'inscription dimanche 29 août 2004 Statut Membre Dernière intervention 31 décembre 2004
29 août 2004 à 20:59
Re Salut

Et merci de m'aider!!

Donc dans mon script j'utilise bien du WMI et je souhaite récupérer les infos d'une série de machine pour les enregistrer sur un serveur mais actuellement ce script me retourne toujours les informations du serveur quand je l'execute sur ces machines!

Mon script (qui est dans un include *.vbs):

function MachineTrack()
'--------------------------------------------------------------------
'--- Initialisation
'--------------------------------------------------------------------
Set objRegistry = GetObject("winmgmts://./root/default:StdRegProv")
Const HKEY_LOCAL_MACHINE = &H80000002

'--------------------------------------------------------------------
'--- Recuperation Nom NetBios, Type de machine, Memoire
'--------------------------------------------------------------------
Set CompSysSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_ComputerSystem")
For each ComputerSystem in CompSysSet

'--------------------------------------------------------------------
'--- Nom NetBios
'--------------------------------------------------------------------
if not isnull(ComputerSystem.Caption) then
Machine_Name = ComputerSystem.Caption
End if

'--------------------------------------------------------------------
'--- Ram
'--------------------------------------------------------------------
If not isnull(ComputerSystem.TotalPhysicalMemory) then
Machine_Ram = FormatNumber(ComputerSystem.TotalPhysicalMemory / 1048576 , 0)
End if

'--------------------------------------------------------------------
'--- Domaine
'--------------------------------------------------------------------
If not isnull(ComputerSystem.Domain) then
Machine_Domain = ComputerSystem.Domain
End if

'--------------------------------------------------------------------
'--- Trigramme utilisateur
'--------------------------------------------------------------------
If not isnull(ComputerSystem.UserName) then
UserTrig = split(ComputerSystem.UserName,"")
Machine_User = USerTrig(1)
End if
Next

'--------------------------------------------------------------------
'--- Recuperation infos processeurs
'--------------------------------------------------------------------
Counter = 0
FreqType = ""

Set ProcessorSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_Processor")
for each Processor in ProcessorSet
Counter = Counter + 1

'--------------------------------------------------------------------
'--- Type et Fréquence du Processeur
'--------------------------------------------------------------------
If not isnull(Processor.Name) Then
If not isnull(Processor.CurrentClockSpeed) then
If Counter > 1 Then
FreqType = " - " & Processor.Name & " " & CStr(Processor.CurrentClockSpeed)
Else
FreqType = Processor.Name & " " & CStr(Processor.CurrentClockSpeed)
End If
End If
Else
If Counter > 1 Then
FreqType = " - " & Processor.Name
Else
FreqType = Processor.Name
End If
End if
Next

Machine_ProcessorNumber = Counter
Machine_ProcessorFreq = FreqType

'--------------------------------------------------------------------
'--- Recuperation infos disques
'--------------------------------------------------------------------
Counter = 0
HDCapacity = 0
HDInterface = ""

Set DiskSet = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_DiskDrive")
for each DiskDrive in DiskSet
Counter = Counter + 1

'--------------------------------------------------------------------
'--- Taille du disque en Go
'--------------------------------------------------------------------
If not isnull(DiskDrive.Size) Then
HDCapacity = FormatNumber(DiskDrive.Size / 1048576 / 1024 , 2)
HDCapacity = Replace(HDCapacity,",",".")
End if

'--------------------------------------------------------------------
'--- Interface du Disque
'--------------------------------------------------------------------
If not isnull(DiskDrive.InterfaceType) Then
If Counter > 1 Then
HDInterface = " - " & DiskDrive.InterfaceType
Else
HDInterface = DiskDrive.InterfaceType
End If
End if
Next
Machine_HDCapacity = HDCapacity
Machine_HDInterface = HDInterface
Machine_HDNumber = Counter

'--------------------------------------------------------------------
'--- Recuperation infos carte son
'--------------------------------------------------------------------
Set SoundSet = GetObject("winmgmts:").InstancesOf("Win32_SoundDevice")
For each SoundIC in SoundSet
If not isnull(SoundIC.Description) then
Machine_SoundCard = SoundIC.Description
End If
Next

'--------------------------------------------------------------------
'--- Recuperation infos nic
'--------------------------------------------------------------------
Set NetworkSet = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapter")
For each NetworkAdapter in NetworkSet

'--------------------------------------------------------------------
'--- Description de la carte reseau
'--------------------------------------------------------------------
If Left(NetworkAdapter.AdapterType,8) = "Ethernet" and Right(NetworkAdapter.Description,8) <> "Miniport" Then
If not isnull(NetworkAdapter.Description) then
Machine_NIC = NetworkAdapter.Description
End if
End if
Next

'--------------------------------------------------------------------
'--- Recuperation Adresse Ip, gateway
'--------------------------------------------------------------------
Set NetConfSet = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For each NetConf in NetConfSet
If Not isnull(NetConf.IPAddress) then
for i=LBound(NetConf.IPAddress) to UBound(NetConf.IPAddress)
if NetConf.IpAddress(i) <> "" and NetConf.IpAddress(i) <> "0.0.0.0" then
Machine_IPAddress = NetConf.IPAddress(i)
end if
next
End if
Next

'--------------------------------------------------------------------
'--- Recuperation Infos Modem
'--------------------------------------------------------------------
Set ModemSet = GetObject("winmgmts:").InstancesOf("Win32_POTSModem ")
For each Modem in ModemSet

'--------------------------------------------------------------------
'--- Description du Modem
'--------------------------------------------------------------------
If not isnull(Modem.Caption) then
Machine_Modem = Modem.Caption
End if
Next

'--------------------------------------------------------------------
'--- Recuperation infos video
'--------------------------------------------------------------------
Set VideoSet = GetObject("winmgmts:").InstancesOf("Win32_VideoController")
For each VideoAdapter in VideoSet

'--------------------------------------------------------------------
'--- Carte video
'--------------------------------------------------------------------
If not isnull(VideoAdapter.Caption) then
Machine_VideoControler = VideoAdapter.Caption
End if
'--------------------------------------------------------------------
'--- Mode video
'--------------------------------------------------------------------
If not isnull(VideoAdapter.VideoModeDescription) then
Machine_VideoResolution = VideoAdapter.VideoModeDescription
End if
Next

'--------------------------------------------------------------------
'--- Recuperation infos OS
'--------------------------------------------------------------------
Set OSSet = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")
For each OS in OSSet

'--------------------------------------------------------------------
'--- System Exploitation
'--------------------------------------------------------------------
If not isnull(OS.Caption) then
Machine_OS = OS.Caption
End if

'--------------------------------------------------------------------
'--- Version du System Exploitation
'--------------------------------------------------------------------
If not isnull(OS.Version) then
Machine_OSVersion = OS.Version
End if

'--------------------------------------------------------------------
'--- Service Pack
'--------------------------------------------------------------------
If not isnull(OS.CSDVersion) then
Machine_OSServicePack = OS.CSDVersion
End if
Next
End function

Et sur la page je l'execute après l'envoi d'un formulaire avec une condition :

If Request.form("Submit") = "Envoyer" Then
Response.write(MachineTrack())
End If

Et la je reçois toutes les variables de mon script mais elles contiennent les infos du serveur.

Merci.
0
youp49 Messages postés 15 Date d'inscription dimanche 29 août 2004 Statut Membre Dernière intervention 31 décembre 2004
30 août 2004 à 19:02
Heu non mon include n'est pas un *.vbs c'est un *.asp tout bètement

+++
Merci de votre aide
0
Rejoignez-nous