- Dim args, oWinNT, oDomain
- Dim Name
- Set Shell = WScript.CreateObject("WScript.Shell")
- domain="votre_domaine"
- set oWinNT=GetObject("WinNT://" & domain)
-
- Const ForReading = 1, ForWriting = 2
- Set WshShell = WScript.CreateObject("WScript.Shell")
- Dim fso, f
- Set fso = CreateObject("Scripting.FileSystemObject")
- objOutFile = "C:\temp\ADListPC.txt"
- Set f = fso.OpenTextFile(objOutFile, ForWriting,true)
- for each oDomain in oWinNT
- if lcase(oDomain.class)="computer" then
- Name = oDomain.name
- if lcase(Mid(Name, 1,3))="lap" or lcase(Mid(Name, 1,3))="pos" then
- f.writeline(Name)
- end if
- end if
- next
-
- '--------------------------------------------------------------------
- ' Sous programme de test du moteur
- ' Vu les sorties générées, c'est CSCRIPT (et non pas WSCRIPT)
- ' qui doit être utilisé
- Sub TestHost
- dim rep
- SW_SHOWNORMAL=1
- strFullName =lcase(WScript.FullName)
- strappli=lcase(Wscript.ScriptFullName)
- i=InStr(1,strFullName,".exe",1)
- j=InStrRev(strFullName,"\",i,1)
- strCommand=Mid(strFullName,j+1,i-j-1)
- if strCommand<>"cscript" then
- rep=MsgBox("Ce script doit être lancé avec CSCRIPT" & VBCRLF & _
- "Cela peut être rendu permanent avec la commande" & VBCRLF & _
- "cscript //H:CScript //S /Nologo" & VBCRLF & _
- "Voulez-vous que ce soit fait automatiquement?", _
- vbYesNo + vbQuestion,strappli)
- if rep=vbYes then
- nomcmd="setscript.bat"
- Set ficcmd = fso.CreateTextFile(nomcmd)
- ficcmd.writeline "@echo off"
- ficcmd.writeline "cscript //H:CScript //S /Nologo"
- ficcmd.writeline "pause"
- ficcmd.writeline chr(34) & strappli & chr(34)
- ficcmd.writeline "pause"
- ficcmd.close
- shell.Run nomcmd, SW_SHOWNORMAL,true
- end if
- WScript.Quit
- end if
- end sub
- '--------------------------------------------------------------------
Dim args, oWinNT, oDomain
Dim Name
Set Shell = WScript.CreateObject("WScript.Shell")
domain="votre_domaine"
set oWinNT=GetObject("WinNT://" & domain)
Const ForReading = 1, ForWriting = 2
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim fso, f
Set fso = CreateObject("Scripting.FileSystemObject")
objOutFile = "C:\temp\ADListPC.txt"
Set f = fso.OpenTextFile(objOutFile, ForWriting,true)
for each oDomain in oWinNT
if lcase(oDomain.class)="computer" then
Name = oDomain.name
if lcase(Mid(Name, 1,3))="lap" or lcase(Mid(Name, 1,3))="pos" then
f.writeline(Name)
end if
end if
next
'--------------------------------------------------------------------
' Sous programme de test du moteur
' Vu les sorties générées, c'est CSCRIPT (et non pas WSCRIPT)
' qui doit être utilisé
Sub TestHost
dim rep
SW_SHOWNORMAL=1
strFullName =lcase(WScript.FullName)
strappli=lcase(Wscript.ScriptFullName)
i=InStr(1,strFullName,".exe",1)
j=InStrRev(strFullName,"\",i,1)
strCommand=Mid(strFullName,j+1,i-j-1)
if strCommand<>"cscript" then
rep=MsgBox("Ce script doit être lancé avec CSCRIPT" & VBCRLF & _
"Cela peut être rendu permanent avec la commande" & VBCRLF & _
"cscript //H:CScript //S /Nologo" & VBCRLF & _
"Voulez-vous que ce soit fait automatiquement?", _
vbYesNo + vbQuestion,strappli)
if rep=vbYes then
nomcmd="setscript.bat"
Set ficcmd = fso.CreateTextFile(nomcmd)
ficcmd.writeline "@echo off"
ficcmd.writeline "cscript //H:CScript //S /Nologo"
ficcmd.writeline "pause"
ficcmd.writeline chr(34) & strappli & chr(34)
ficcmd.writeline "pause"
ficcmd.close
shell.Run nomcmd, SW_SHOWNORMAL,true
end if
WScript.Quit
end if
end sub
'--------------------------------------------------------------------