2 sonuçtan 1 ile 2 arası

Konu: Scheduled Task Script

  1. #1

    Standart Scheduled Task Script

    MerhaBA 2003 Dc uzerınde Çalışan 50client (Dom.User Locallerinde).
    Her ayın ilk gunu bir script çalıştıracaklar HDD'i önce Disk Cleanup Yapacak
    DaHA Sonrasında Defragment Yapacak.Bunun için bir script varmıdır.
    Teşekkurler
     

  2. #2

    Standart Ynt: Scheduled Task Script

    Merhaba,

    Defrag islemi icin script: (.vbs olarak kaydedip kullanabilirsiniz.)

    'defrag_all2.vbs
    'Defrags all hard disks - Can be run as a Scheduled Task
    'Modified to create an error log and display it
    '© MSHowto.org - 20/07/2008

    Option Explicit

    Dim WshShell, fso, d, dc, ErrStr(), Return, X, A(), MyFile, I, MyBox, Drive

    Set WshShell = WScript.CreateObject("WScript.Shell&quot
    Set fso = CreateObject("Scripting.FileSystemObject&quot
    X = 0

    Set dc = fso.Drives
    For Each d in DC
    If d.DriveType = 2 Then
    X = X + 1

    'Determine drive letter of first fixed disk
    'This is the drive that the error report will be placed on
    If X = 1 Then
    Drive = d
    End If
    End If
    Next

    ReDim A(X)
    ReDim ErrStr(X)

    X = 0
    For Each d in dc
    If d.DriveType = 2 Then
    X = X + 1
    Return = WshShell.Run("defrag " & d & " -f", 1, TRUE)

    'Determine the Error code returned by Defrag for the current drive and save it
    If return = 0 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag completed successfully" & vbCRLF
    elseif return = 1 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (defrag was cancelled manually) " & vbCRLF
    elseif return = 2 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (there was a command line error. Check your command line for valid switches and drives)" & vbCRLF
    elseif return = 3 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (there was an unknown error)" & vbCRLF
    elseif return = 4 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (defrag could not run due to insufficient memory resources)" & vbCRLF
    'errorlevel 5 is not currently used
    elseif return = 5 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (general error)" & vbCRLF
    elseif return = 6 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & "(System error: either the account used to run defrag is not an administrator, there is a problem loading the resource DLL, or a defrag engine could not be accessed. Check for proper user permissions and run Sfc.exe to validate system files)" & vbCRLF
    elseif return = 7 then
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with error level " & return & " (There is not enough free space on the drive. Defrag needs 15% free space to run on a volume)" & vbCRLF
    else
    ErrStr(x) = ErrStr(x) & "Drive " & d & " Defrag aborted with an unknown error level: " & return & vbCRLF
    end if

    End If
    Next

    'Create the Error Report in the root of the first fixed disk.
    Set MyFile = fso.OpenTextFile(Drive & "\defragreport.txt", 2, True)
    MyFile.WriteLine(Date) & vbCRLF
    MyFile.WriteLine(Time) & vbCRLF
    For I = 1 to X
    MyFile.WriteLine(ErrStr(I))
    Next
    MyFile.Close

    Return = WshShell.Run(Drive & "\defragreport.txt",3,True)

    Set WshShell = Nothing
    Set fso = Nothing


    Disk Cleanup islemi icin batch dosyasi: (.bat yaparak kullanabilirsiniz.)

    c:\windows\system32\cleanmgr.exe /dc /sageset: 1
    c:
    cd \
    cd c:\windows\prefetch
    del *.* /q


    Emre AYDIN
    Emre Aydın
    MVP | Office 365 | Since 2006
    MCT | Since 2005
    MCSD | Azure Solutions Architect
    MCSE | Private Cloud, Messaging, Communication, Server Infrastructure, Productivity, Platform
    MCSA | Office 365, Server 2012, Cloud Platform
    MCTS | Developing Azure Solutions, Implementing Azure Infrastructure, Architecting Microsoft Azure Solutions, SAM
    P-Seller
    Intelligent Cloud | EMS
    Web : www.mshowto.org
    Mail : emre.aydin [@] mshowto.org
    Twitter : https://twitter.com/emreaydn
    Linkedin : tr.linkedin.com/in/emreaydn

Benzer Konular

  1. Cevaplar: 1
    Son Mesaj: 05-04-2011, 01:51 PM
  2. Startup Script'i Hk.
    By imposible in forum Server2003
    Cevaplar: 1
    Son Mesaj: 08-08-2008, 10:33 AM
  3. script ile kullanıcı tanımlan
    By ekinonline in forum Server2003
    Cevaplar: 9
    Son Mesaj: 06-08-2008, 01:12 PM
  4. Scheduled Auto Shutdown
    By social in forum Server2003
    Cevaplar: 1
    Son Mesaj: 10-12-2007, 09:50 AM
  5. xp de logoff script..
    By davudows in forum Microsoft Windows
    Cevaplar: 3
    Son Mesaj: 10-28-2006, 12:20 AM

Yetkileriniz

  • Konu Açma Yetkiniz Yok
  • Cevap Yazma Yetkiniz Yok
  • Eklenti Yükleme Yetkiniz Yok
  • Mesajınızı Değiştirme Yetkiniz Yok
  •  
Hakkımızda
MSHOWTO, herhangi bir firma ya da kuruluş ile bağı olmayan bağımsız teknik bir topluluktur.
Sosyal Medya Linklerimiz