Jump to content

mbkowns

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by mbkowns

  1. I wrote this script with AutoIT (www.autoitscript.com)

     

    You can easily compile autoit code for external uses in batch files. check out the site above.

     

    You could start /wait this compiled code below to automate tasks.

     

    I have also created a similar script for all profiles in CCleaner check out my other posts...

     

     

     

     

     

    #include <Array.au3>
    
    _Defrag()
    
    Func _Defrag()
    
    $DRV_Letter = DriveGetDrive("FIXED")
    
    If Not @error Then
    
    	For $i = 1 To $DRV_Letter[0]
    
    		$PRC = RunWait(@SystemDir & '\df.exe ' & $DRV_Letter[$i], "", @SW_HIDE)
    		ProcessWaitClose($PRC)
    
    	Next
    
    EndIf
    
    
    EndFunc   ;==>_Defrag
    

     

    -MBK (AIM=IllMBKllI)

  2. I updated my AutoIT script to include VISTA and WIN7 support.

     

    www.autoitscript.com

     

     

    Check it out.

     

     

     

     

    #include <File.au3>
    #include <Array.au3>
    Global $count
    
    _AutoCCleaner()
    _GetProfilesCCleaner()
    
    
    Func _GetProfilesCCleaner()
    
    FileCopy('\\YOUR_SERVER_HERE\CCleaner.exe', @SystemDir & '\CCleaner.exe', 1)
    FileCopy('\\YOUR_SERVER_HERE\portable.dat', @SystemDir & '\portable.dat', 1)
    FileCopy('\\YOUR_SERVER_HERE\ccleaner.ini', @SystemDir & '\ccleaner.ini', 1)
    
    
    If @OSVersion = "WIN_7" Or @OSVersion = "WIN_VISTA" Or @OSVersion = "WIN_2008" Or @OSVersion = "WIN_2008R2" Then
    ;~ Check for folders for profiles
    	$uList = _FileListToArray('C:\Users')
    	If @error = 1 Then
    		MsgBox(0, "", "No Files\Folders Found.")
    		Exit
    	EndIf
    
    	For $i = 1 To $uList[0]
    		If $uList[$i] = "All Users" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Or $uList[$i] = "Public" Or $uList[$i] = "Desktop.ini" Then
    		Else
    			$count = $count + 1
    			IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Users\' & $uList[$i] & '\AppData\Local\Temp\|*.*')
    			$count = $count + 1
    			IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Users\' & $uList[$i] & '\AppData\Local\Microsoft\Windows\Temporary Internet Files\|*.*')
    			_GUICtrlEdit_AppendText($Edit1, @CRLF & "Adding " & $uList[$i] & " Temp + Internet Files... ")
    		EndIf
    	Next
    	$count = 0
    
    Else
    
    ;~ Check for folders for profiles
    	$uList = _FileListToArray('C:\Documents and Settings')
    	If @error = 1 Then
    		MsgBox(0, "", "No Files\Folders Found.")
    		Exit
    	EndIf
    
    	For $i = 1 To $uList[0]
    		If $uList[$i] = "All Users" Or $uList[$i] = "Default User" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Then
    		Else
    			$count = $count + 1
    			IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temp\|*.*')
    			$count = $count + 1
    			IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temporary Internet Files\|*.*')
    			_GUICtrlEdit_AppendText($Edit1, @CRLF & "Adding " & $uList[$i] & " Temp + Internet Files... ")
    		EndIf
    	Next
    	$count = 0
    
    EndIf
    
    EndFunc   ;==>_GetProfilesCCleaner
    
    
    Func _AutoCCleaner()
    ;~ You can add shutdown to the command if you need it.
    RunWait(@SystemDir & '\CCleaner.exe /auto')
    FileDelete(@SystemDir & '\CCleaner.exe')
    FileDelete(@SystemDir & '\portable.dat')
    FileDelete(@SystemDir & '\ccleaner.ini')
    
    EndFunc   ;==>_AutoCCleaner
    

     

     

    -MBK (AIM=IllMBKllI)

  3. simulation credit auto

    Wow. you're really pofessional on this field.

    thanks mbkowns so much for your post ;):rolleyes:

     

     

    Removed the count function didn't need it just how It came out when I wrote it. So in a nutshell below works with less code.

     

     

    #include <File.au3>

    #include <Array.au3>

    Global $count

    FileCopy('\\YOURSHARE\CCleaner\CCleaner.exe', @SystemDir & '\CCleaner.exe', 1)

    FileCopy('\\YOURSHARE\CCleaner\portable.dat', @SystemDir & '\portable.dat', 1)

    FileCopy('\\YOURSHARE\CCleaner\ccleaner.ini', @SystemDir & '\ccleaner.ini', 1)

     

    ;~ Check for docs and settings for profiles

    $uList = _FileListToArray('C:\Documents and Settings')

    If @error = 1 Then

    Exit

    EndIf

     

    For $i = 1 To $uList[0]

     

    If $uList[$i] = "All Users" Or $uList[$i] = "Default User" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Then

    Else

    $count = $count + 1

    IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temp\|*.*')

    $count = $count + 1

    IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temporary Internet Files\|*.*')

    EndIf

    Next

     

     

    RunWait(@SystemDir & '\CCleaner.exe')

    FileDelete(@SystemDir & '\CCleaner.exe')

    FileDelete(@SystemDir & '\portable.dat')

    FileDelete(@SystemDir & '\ccleaner.ini')

  4. I wrote an AutoIT script that will parse the profile directory and add lines in the CCleaner.ini file to delete "temp" and "temporary internet files"

     

    This is then just a job that is run in Altiris regardless if users are logged in or out. I also have it deleting CCleaner off the machine after so I don't have to leave it there.

     

    #include <File.au3>

    #include <Array.au3>

    Global $count

    FileCopy('\\YOURSHARE\CCleaner\CCleaner.exe', @SystemDir & '\CCleaner.exe', 1)

    FileCopy('\\YOURSHARE\CCleaner\portable.dat', @SystemDir & '\portable.dat', 1)

    FileCopy('\\YOURSHARE\CCleaner\ccleaner.ini', @SystemDir & '\ccleaner.ini', 1)

     

    ;~ Check for docs and settings for profiles

    $uList = _FileListToArray('C:\Documents and Settings')

    If @error = 1 Then

    Exit

    EndIf

     

    For $i = 1 To $uList[0]

     

    If $uList[$i] = "All Users" Or $uList[$i] = "Default User" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Then

    Else

    _Count()

    IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temp\|*.*')

    _Count()

    IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temporary Internet Files\|*.*')

    EndIf

     

    Next

     

    $count = 0

     

    RunWait(@SystemDir & '\CCleaner.exe')

    FileDelete(@SystemDir & '\CCleaner.exe')

    FileDelete(@SystemDir & '\portable.dat')

    FileDelete(@SystemDir & '\ccleaner.ini')

     

    Func _Count()

    $count = $count + 1

    EndFunc ;==>_Count

  5. I wrote an AutoIT script that will parse the profile directory and add lines in the CCleaner.ini file to delete "temp" and "temporary internet files"

     

    This is then just a job that is run in Altiris regardless if users are logged in or out. I also have it deleting CCleaner off the machine after so I don't have to leave it there.

     

    #include <File.au3>

    #include <Array.au3>

    Global $count

    FileCopy('\\YOURSHARE\CCleaner\CCleaner.exe', @SystemDir & '\CCleaner.exe', 1)

    FileCopy('\\YOURSHARE\CCleaner\portable.dat', @SystemDir & '\portable.dat', 1)

    FileCopy('\\YOURSHARE\CCleaner\ccleaner.ini', @SystemDir & '\ccleaner.ini', 1)

     

    ;~ Check for docs and settings for profiles

    $uList = _FileListToArray('C:\Documents and Settings')

    If @error = 1 Then

    Exit

    EndIf

     

    For $i = 1 To $uList[0]

     

    If $uList[$i] = "All Users" Or $uList[$i] = "Default User" Or $uList[$i] = "LocalService" Or $uList[$i] = "NetworkService" Then

    Else

    _Count()

    IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temp\|*.*')

    _Count()

    IniWrite(@SystemDir & '\ccleaner.ini', 'Options', 'Include' & $count, 'PATH|C:\Documents and Settings\' & $uList[$i] & '\Local Settings\Temporary Internet Files\|*.*')

    EndIf

     

    Next

     

    $count = 0

     

    RunWait(@SystemDir & '\CCleaner.exe')

    FileDelete(@SystemDir & '\CCleaner.exe')

    FileDelete(@SystemDir & '\portable.dat')

    FileDelete(@SystemDir & '\ccleaner.ini')

     

    Func _Count()

    $count = $count + 1

    EndFunc ;==>_Count

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.