[VBS] MyNewChkDsk.vbs

Poster ici les programmes utiles que vous avez découverts
Avatar de l’utilisateur
Hackoo
newbie
newbie
Messages : 6
Inscription : 17 mai 2014 06:06
Localisation : Tunisie
Contact :

[VBS] MyNewChkDsk.vbs

Message par Hackoo » 17 mai 2014 13:31

Salut,
C'est un vbscript pour la maintenance de vos disques durs fixes et amovibles ,qui sert pour la vérification et la correction des erreurs sur ces derniers s'il y a lieu avec génération d'un rapport de scan !

Image

un message va vous informer que "un scan planifié de ce dernier a été programmé, il sera vérifié au prochain redémarrage du système", et qu'il faut redémarrer. Alors, redémarrer et le disque sera vérifié et réparé au besoin.

Image

Code : Tout sélectionner

Option Explicit
Dim fso,MonLecteur,MaCmd,Reboot,LogTmpFile,LogFile,ws,Temp
Dim Titre,MsgTitre,MsgAttente,Copyright,oExec,i,Question
Set fso = CreateObject("Scripting.FileSystemObject")
Copyright = "© Hackoo © 2014"
Set ws = CreateObject("WScript.Shell")
Temp = ws.ExpandEnvironmentStrings("%Temp%")
LogTmpFile = "MyTmpLog.txt"
LogFile = "LOG_CHKDSK.log"
If fso.FileExists(LogFile) Then fso.DeleteFile(LogFile)
Titre = "Vérification des erreurs sur les disques fixes et amovibles " & Copyright
MsgAttente = "Vérification et correction des erreurs sur les disques fixes et amovibles . . . "
Call UAC()
Call CreateProgressBar(Titre,MsgAttente)
Call LancerProgressBar()
Call Pause(2)
MonLecteur = Split(GetMyLogicDisk,":")
For i = LBound(MonLecteur) To UBound(MonLecteur) - 1
	MaCmd = "echo O| CHKDSK /F "& MonLecteur(i) & ": > "& LogTmpFile &_
	" & cmd /U /C Type " & LogTmpFile & " >> " & LogFile & " & Del " & LogTmpFile & ""
	Call Executer(MaCmd,0,True)
Next
Call FermerProgressBar()
Question = MsgBox ("Un de vos lecteurs est verrouillé !"& VbCrLF &_
"un scan planifié de ce dernier a été programmé, il sera vérifié au prochain redémarrage du système !"& VbCrLF &_
"Voulez-vous redémarrer maintenant ?" ,VBYesNO+VbQuestion,Titre)
If Question = VbYes then
	Reboot = "Shutdown.exe /r /t 120 /c "& DblQuote("Enregistrez vos documents - Redémarrage du PC dans 2 minutes") &""
	Call Executer(Reboot,0,False)
	ws.run LogFile
else
	ws.run LogFile
End if
'**************************************************************************************************************
Function Executer(StrCmd,Console,bWaitOnReturn)
	Dim ws,MyCmd,Resultat
	Set ws = CreateObject("wscript.Shell")
'La valeur 0 pour cacher la console MS-DOS
	If Console = 0 Then
		MyCmd = "CMD /C " & StrCmd & ""
		Resultat = ws.run(MyCmd,Console,bWaitOnReturn)
		If Resultat = 0 Then
		Else
			MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
		End If
	End If
'La valeur 1 pour montrer la console MS-DOS
	If Console = 1 Then
		MyCmd = "CMD /K " & StrCmd & " "
		Resultat = ws.run(MyCmd,Console,bWaitOnReturn)
		If Resultat = 0 Then
		Else
			MsgBox "Une erreur inconnue est survenue !",16,"Une erreur inconnue est survenue !"
		End If
	End If
	Executer = Resultat
End Function
'***********************************************************************************************************
Function GetMyLogicDisk()
	Dim objWMIService,objDisk,MyDevice
	Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
	For Each objDisk in objWMIService.ExecQuery("Select * from Win32_LogicalDisk")
		If objDisk.DriveType = "2" OR objDisk.DriveType = "3" Then 
			MyDevice = MyDevice & objDisk.DeviceID
		End If
	Next
	GetMyLogicDisk = MyDevice
End Function
'***********************************************************************************************************
'Fonction pour ajouter les doubles quotes dans une variable
Function DblQuote(strIn)
	DblQuote = Chr(34) & strIn & Chr(34)
End Function
'***********************************************************************************************************
Sub CreateProgressBar(Titre,MsgAttente)
	Dim ws,fso,f,f2,ts,ts2,Ligne,i,fread,LireTout,NbLigneTotal,Temp,PathOutPutHTML,fhta,oExec
	Set ws = CreateObject("wscript.Shell")
	Set fso = CreateObject("Scripting.FileSystemObject")
	Temp = WS.ExpandEnvironmentStrings("%Temp%")
	PathOutPutHTML = Temp & "\Barre.hta"
	Set fhta = fso.OpenTextFile(PathOutPutHTML,2,True)
	fhta.WriteLine "<HTML>"
	fhta.WriteLine "<HEAD>"
	fhta.WriteLine "<Title>  " & Titre & "</Title>"
	fhta.WriteLine "<HTA:APPLICATION"
	fhta.WriteLine "ICON = ""magnify.exe"" "
	fhta.WriteLine "BORDER=""THIN"" "
	fhta.WriteLine "INNERBORDER=""NO"" "
	fhta.WriteLine "MAXIMIZEBUTTON=""NO"" "
	fhta.WriteLine "MINIMIZEBUTTON=""NO"" "
	fhta.WriteLine "SCROLL=""NO"" "
	fhta.WriteLine "SYSMENU=""NO"" "
	fhta.WriteLine "SELECTION=""NO"" "
	fhta.WriteLine "SINGLEINSTANCE=""YES"">"
	fhta.WriteLine "</HEAD>"
	fhta.WriteLine "<BODY text=""white""><CENTER>"
	fhta.WriteLine "<marquee DIRECTION=""LEFT"" SCROLLAMOUNT=""3"" BEHAVIOR=ALTERNATE><font face=""Comic sans MS"">" & MsgAttente &"</font></marquee>"
	fhta.WriteLine "<img src=""data:image/gif;base64,R0lGODlhgAAPAPIAAP////INPvvI0/q1xPVLb/INPgAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAAgAAPAAAD5wiyC/6sPRfFpPGqfKv2HTeBowiZGLORq1lJqfuW7Gud9YzLud3zQNVOGCO2jDZaEHZk+nRFJ7R5i1apSuQ0OZT+nleuNetdhrfob1kLXrvPariZLGfPuz66Hr8f8/9+gVh4YoOChYhpd4eKdgwDkJEDE5KRlJWTD5iZDpuXlZ+SoZaamKOQp5wAm56loK6isKSdprKotqqttK+7sb2zq6y8wcO6xL7HwMbLtb+3zrnNycKp1bjW0NjT0cXSzMLK3uLd5Mjf5uPo5eDa5+Hrz9vt6e/qosO/GvjJ+sj5F/sC+uMHcCCoBAAh+QQJCgAAACwAAAAAgAAPAAAD/wi0C/4ixgeloM5erDHonOWBFFlJoxiiTFtqWwa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ueTp8uv07ezZ5fa08Piz/8UAYhPo7t6+CfDcafDGbOG5hhcYKoz4cGIrh80cPAOQAAAh+QQJCgAAACwAAAAAgAAPAAAD5wi0C/6sPRfJpPGqfKv2HTeBowiZGLORq1lJqfuW7Gud9YzLud3zQNVOGCO2jDZaEHZk+nRFJ7R5i1apSuQ0OZT+nleuNetdhrfob1kLXrvPariZLGfPuz66Hr8f8/9+gVh4YoOChYhpd4eKdgwFkJEFE5KRlJWTD5iZDpuXlZ+SoZaamKOQp5wAm56loK6isKSdprKotqqttK+7sb2zq6y8wcO6xL7HwMbLtb+3zrnNycKp1bjW0NjT0cXSzMLK3uLd5Mjf5uPo5eDa5+Hrz9vt6e/qosO/GvjJ+sj5F/sC+uMHcCCoBAA7AAAAAAAAAAAA"" />"
	fhta.WriteLine "</CENTER></BODY></HTML>"
	fhta.WriteLine "<SCRIPT LANGUAGE=""VBScript""> "
	fhta.WriteLine "Set ws = CreateObject(""wscript.Shell"")"
	fhta.WriteLine "Temp = WS.ExpandEnvironmentStrings(""%Temp%"")"
	fhta.WriteLine "Sub window_onload()"
	fhta.WriteLine "    CenterWindow 480,110"
	fhta.WriteLine "    Self.document.bgColor = ""DarkOrange"" "
	fhta.WriteLine " End Sub"
	fhta.WriteLine " Sub CenterWindow(x,y)"
	fhta.WriteLine "    Dim iLeft,itop"
	fhta.WriteLine "    window.resizeTo x,y"
	fhta.WriteLine "    iLeft = window.screen.availWidth/2 - x/2"
	fhta.WriteLine "    itop = window.screen.availHeight/2 - y/2"
	fhta.WriteLine "    window.moveTo ileft,itop"
	fhta.WriteLine "End Sub"
	fhta.WriteLine "</script>"
	fhta.close
End Sub
'**********************************************************************************************
Sub LancerProgressBar()
	Set oExec = Ws.Exec("mshta.exe " & Temp & "\Barre.hta")
End Sub
'**********************************************************************************************
Sub FermerProgressBar()
	oExec.Terminate
End Sub
'**********************************************************************************************
Sub Pause(NSeconds)
	Wscript.Sleep(NSeconds*1000)
End Sub  
'**********************************************************************************************
Function DblQuote(Str)
	DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
Sub UAC()
'Run this subroutine FIRST THING on any script that may require admin
'priveleges. It will generate a "User Access Control" prompt on Vista
'or generate a "Run As" prompt for admin priveleges on 2K/XP (if the 
'2K/XP user isn't an admin). It will do nothing on Win9x systems or 
'on Win2K/XP systems with a logged-in admin.
Const FOR_WRITING = 2
Const TEMP_FOLDER = 2
Dim ws, fs, ts, wmi, col, obj
Dim strData, strUacFile, strArg, strArgs, strOsVersion, strUserName, strGroup, strMember
Dim lngArg, lngOsVersion
Dim blnIsAdmin, blnHasAdmins
	'See if we can create needed objects
	On Error Resume Next
	Err.Clear
	Set fs = CreateObject("Scripting.FileSystemObject")
	Set ws = CreateObject("WScript.Shell")
	Set wmi = GetObject("winmgmts:\\.\root\CIMV2")
	If Err.Number <> 0 Then Exit Sub 'Reasonable assumption it's Win9x?
	On Error Goto 0
	'Define the name of the special script that will re-launch this one for UAC if needed.
	'Can't use %TEMP% or other per-user folder, can't use script folder because it might be
	'in protected area. 
	strUacFile = ""
	If strUacFile = "" Then
		'First try to use "shared docs" because everyone can get to it.
		strUacFile = ws.RegRead("HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Documents")
		If strUacFile <> "" Then
			If fs.FolderExists(strUacFile) Then 
				strUacFile = fs.BuildPath(strUacFile, "~" & fs.GetBaseName(WScript.ScriptName) & ".vbs")
			Else
				strUacFile = ""
			End If
		End If
	End If
	If strUacFile = "" Then
		'Last choice is the drive root. At least we know it exists!
		strUacFile = fs.BuildPath(fs.GetDriveName(WScript.Path) & "\", "~" & fs.GetBaseName(WScript.ScriptName) & ".vbs")
	End If
	'If the UAC script exists, we can assume it launched this one! It should be deleted.
	If fs.FileExists(strUacFile) Then
		fs.DeleteFile strUacFile
		Exit Sub
	End If	
	'Find the Operating System major version
	Set col = wmi.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 48)
	strOsVersion = "0.0"
	For Each obj In col : strOsVersion = obj.Version : Next
	If Instr(strOsVersion, ".") Then strOsVersion = Left(strOsVersion, Instr(strOsVersion, ".") - 1)
	lngOsVersion = CLng(strOsVersion)
	'If the OS is less than W2K, everybody is an admin and no UAC prompt is needed
	If lngOsVersion < 5 Then Exit Sub
	'Find the user name (needed to see if the user is an admin)
	Set col = wmi.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", 48)
	strUserName = ""
	For Each obj In col : strUserName = obj.UserName : Next
	If Instr(strUserName, "\") Then	strUserName = Mid(strUserName, Instr(strUserName, "\") + 1)
	'See if the user is an admin
	blnIsAdmin = False
	blnHasAdmins = False
	Set col = wmi.ExecQuery("SELECT * FROM Win32_GroupUser", "WQL", 48)
	For Each obj In col
		strGroup = obj.GroupComponent
		strGroup = Split(strGroup, "=")
		If strGroup(UBound(strGroup)) = """Administrateurs""" Then
			blnHasAdmins = True
			strMember = obj.PartComponent
			strMember = Split(strMember, "=")
			If strMember(UBound(strMember)) = """" & strUserName & """" Then
				blnIsAdmin = True
			End If
		End If
	Next
	If blnHasAdmins = False Then blnIsAdmin = True 'If no admin group then everybody is an admin?
	'Final test. No UAC prompt is needed if user is admin on something less than Vista
	If ((lngOsVersion < 6) And (blnIsAdmin)) Then Exit Sub
	'This is definitely a directly-run script. We need to re-launch it to get a UAC.
	'First collect any arguments the script has so we can re-launch it exactly the same.
	For lngArg = 0 To WScript.Arguments.Count - 1
		If strArgs <> "" Then strArgs = strArgs & " "
		strArg = WScript.Arguments(lngArg)
		If ((InStr(strArg, " ") <> 0) Or (InStr(strArg, vbTab) <> 0)) Then 
			strArg = """" & """" & strArg & """" & """"
		End If
		strArgs = strArgs & strArg
	Next
	'Now build the actual command that will re-launch the script with a UAC prompt
	strData = "CreateObject(""Shell.Application"").ShellExecute "
	strData = strData & """" & """" & """" & Wscript.FullName & """" & """" & """"
	strData = strData & ", "
	strData = strData & """" & """" & """" & WScript.ScriptFullName & """" & """"
	If strArgs = "" Then
		strData = strData & """, "
	Else
		strData = strData & " " & strArgs & """, "
	End If
	strData = strData & """" & """" & """" & fs.GetParentFolderName(WScript.ScriptFullName) & """" & """" & """"
	strData = strData & ", "
	strData = strData & """runas"""
	strData = strData & ", 1"
	'Save the UAC command in a separate script
	Set ts = fs.OpenTextFile(strUacFile, FOR_WRITING, True)
	ts.Write strData
	ts.Close
	'Show a message
	'Wscript.Echo "This script will need administrative priveleges."
	'Launch the UAC script
	ws.Run "wscript.exe" & " """ & strUacFile & """", 1, False
	'We MUST exit at this point and let the UAC script re-launch us.
	WScript.Quit
End Sub
'**********************************************************************************************




Répondre

Revenir vers « Programmes utiles »