cs_ghofrane
Messages postés44Date d'inscriptionmardi 18 juillet 2006StatutMembreDernière intervention11 août 2009
-
14 mars 2007 à 21:58
CCJ
Messages postés565Date d'inscriptionmercredi 19 mai 2004StatutMembreDernière intervention30 avril 2008
-
15 mars 2007 à 18:49
bonsoir,
est ce que je peux exécuter par exemple la commande
net start ou ping ou ipconfig ... a travers un fichier vbscript.
c'est à dire en appyant sur un bouton je lance un fichier
vbscript qui lui va lancer la commande dos voulu.
merci
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}!\")._
ExecQuery("select * from Win32_PingStatus where address = '" & strComputer & "'")
For Each objStatus in objPing
If objStatus.Statuscode = 0 Then
msgbox "status= " & objStatus.Statuscode,vbInformation,strComputer & " repond au ping !"
else
msgbox "status= " & objStatus.StatusCode,vbCritical,strComputer & " n a pas repondu au ping!"
End If
Next
'------------------------------------------------------------------------
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec( _
"ping -n 2 -w 1000 " & strComputer)
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
If InStr(strPingResults, "perdus = 0") Then
MsgBox strPingResults,vbInformation,strComputer & " repond au ping !"
Else
MsgBox strPingResults,vbCritical,strComputer & " na pas repondu au ping!"
End If
cs_ghofrane
Messages postés44Date d'inscriptionmardi 18 juillet 2006StatutMembreDernière intervention11 août 2009 15 mars 2007 à 18:34
salut
merci les amis pour l'information.
c'est parce que tu le veux et tu le mérite CCJ.
merci pour les codes JMO, c'est très intéressant.
je crois que je vais me plonger dans leur lecture.
merci.
Vous n’avez pas trouvé la réponse que vous recherchez ?
CCJ
Messages postés565Date d'inscriptionmercredi 19 mai 2004StatutMembreDernière intervention30 avril 20081 15 mars 2007 à 18:49
Aucun merite jai juste fais copier coller
Jvais faire un truc correcte alors :
<html>
<script language="vbscript">
sub Showip_OnClick
Dim objShell,objScriptExec
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec( "ipconfig")
strPingResults = LCase(objScriptExec.StdOut.ReadAll)
msgbox strPingResults
end sub
</script>
</html>
voila pr ipconfig =)
Si l'informatique été de l'alcool il y aurait des genies partout