ioliver Posted August 4, 2005 Share Posted August 4, 2005 I made this script because we are concerned about the size of User Profiles on our Workstations. The script goes out to a computer, that you type in, and checks the size of each User Profile in Documents and Settings. It reports the size of the profile and the Local Settings folder (which I found to be one of the biggest folders in a User Profile), and \Application Data, \Temp, and \Temporary Internet Files. I may, later on, automate a the deleting of \Temp and \Tempory Internet Files if they are to big. Check it out and let me know what you think... expandcollapse popup; Profile Report ; Ian Oliver ; August 1, 2005 ; Creates a report of Profile sizes for a computer $output = FileOpen("C:\Profile Report.htm", 2); Opens file for writing $host = "" Do $host = InputBox("Profile Report", "Input Computer Name:") Until $host <> "" FileWriteLine($output, "<html>") FileWriteLine($output, "<head><title>Profile Report for " & $host & "</title></head>") FileWriteLine($output, "<body>") FileWriteLine($output, "<h2>Profile Report for \\" & $host & "</h2>") FileWriteLine($output, "<hr>") $path = "\\" & $host & "\c$\Documents and Settings" FileChangeDir($path) $search = FileFindFirstFile("*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $filename = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileGetAttrib($filename), "D") Then $outProfileName = $filename $outProfileSz = DirGetSize($path & "\" & $filename) $outProfileSz = Round($outProfileSz / 1048576, 2) $outLocalSettingsSz = DirGetSize($path & "\" & $filename & "\Local Settings") $outLocalSettingsSz = Round($outLocalSettingsSz / 1048576, 2) $outAppDataSz = DirGetSize($path & "\" & $filename & "\Local Settings\Application Data") $outAppDataSz = Round($outAppDataSz / 1048576, 2) $outTempSz = DirGetSize($path & "\" & $filename & "\Local Settings\Temp") $outTempSz = Round($outTempSz / 1048576, 2) $outTempInetFilesSz = DirGetSize($path & "\" & $filename & "\Local Settings\Temporary Internet Files") $outTempInetFilesSz = Round($outTempInetFilesSz /1048576, 2) FileWriteLine($output, "<br>") FileWriteLine($output, "<b>" & $outProfileName & "</b> = " & $outProfileSz & " MB <br>") FileWriteLine($output, "\Local Settings = " & $outLocalSettingsSz & " MB <br>") FileWriteLine($output, " \Application Data = " & $outAppDataSz & " MB <br>") FileWriteLine($output, " \Temp = " & $outTempSz & " MB <br>") FileWriteLine($output, " \Temporary Internet Files = " & $outTempInetFilesSz & " MB <br>") FileWriteLine($output, "<br>") EndIf WEnd FileWriteLine($output, "<hr>") FileWriteLine($output, "</body>") FileWriteLine($output, "</html>") MsgBox("","Profile Report for " & $host, "Profile Report for " & $host & " is ready and is located in C:\Profile Report.htm") Thanks for reading. Your feedback is appreciated. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
Wus Posted August 4, 2005 Share Posted August 4, 2005 Nice little script. I just ran it and geez, I have about 3-4 gig held up in profiles, and most of that is from temp files and temporary internet files Link to comment Share on other sites More sharing options...
CyberSlug Posted August 4, 2005 Share Posted August 4, 2005 Cool. Some simple modifications: 1) Provide own computer name as the default for the input box: 2) Show the report creation time in the report: 3) Allow user to choose path/name of the generated report file via FileSaveDialog. 4) Automatically display report when done. expandcollapse popup; Profile Report ; Ian Oliver ; August 1, 2005 ; Creates a report of Profile sizes for a computer $host = "" Do $host = InputBox("Profile Report", "Input Computer Name:", @ComputerName) Until $host <> "" $path = FileSaveDialog ( "title", "Choose destination for report", "HTML report (*.htm;*.html)", 16, "Profile Report.htm") If @error Then Exit SplashTextOn("Generating report", @LF & "Please wait...", 200, 100, 10, 10) $output = FileOpen($path, 2); Opens file for writing FileWriteLine($output, "<html>") FileWriteLine($output, "<head><title>Profile Report for " & $host & "</title></head>") FileWriteLine($output, "<body>") $date = @Year & "-" & @Mon & "-" & @MDay & " " & @Hour & ":" & @Min FileWriteLine($output, "<h2>Profile Report for \\" & $host & " generated " & $date & "</h2>") FileWriteLine($output, "<hr>") $path = "\\" & $host & "\c$\Documents and Settings" FileChangeDir($path) $search = FileFindFirstFile("*.*") If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf While 1 $filename = FileFindNextFile($search) If @error Then ExitLoop If StringInStr(FileGetAttrib($filename), "D") Then $outProfileName = $filename $outProfileSz = DirGetSize($path & "\" & $filename) $outProfileSz = Round($outProfileSz / 1048576, 2) $outLocalSettingsSz = DirGetSize($path & "\" & $filename & "\Local Settings") $outLocalSettingsSz = Round($outLocalSettingsSz / 1048576, 2) $outAppDataSz = DirGetSize($path & "\" & $filename & "\Local Settings\Application Data") $outAppDataSz = Round($outAppDataSz / 1048576, 2) $outTempSz = DirGetSize($path & "\" & $filename & "\Local Settings\Temp") $outTempSz = Round($outTempSz / 1048576, 2) $outTempInetFilesSz = DirGetSize($path & "\" & $filename & "\Local Settings\Temporary Internet Files") $outTempInetFilesSz = Round($outTempInetFilesSz /1048576, 2) FileWriteLine($output, "<br>") FileWriteLine($output, "<b>" & $outProfileName & "</b> = " & $outProfileSz & " MB <br>") FileWriteLine($output, "\Local Settings = " & $outLocalSettingsSz & " MB <br>") FileWriteLine($output, " \Application Data = " & $outAppDataSz & " MB <br>") FileWriteLine($output, " \Temp = " & $outTempSz & " MB <br>") FileWriteLine($output, " \Temporary Internet Files = " & $outTempInetFilesSz & " MB <br>") FileWriteLine($output, "<br>") EndIf WEnd FileWriteLine($output, "<hr>") FileWriteLine($output, "</body>") FileWriteLine($output, "</html>") MsgBox(4096,"Done","Report Created", 1) Run("cmd /c " & """" & $path & """", "", @SW_HIDE) ;open file Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
ioliver Posted August 4, 2005 Author Share Posted August 4, 2005 Thanks for the comments and suggestions. Keep 'em comming. Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
herewasplato Posted August 5, 2005 Share Posted August 5, 2005 ...I may, later on, automate a the deleting of \Temp and \Tempory Internet Files if they are to big...<{POST_SNAPBACK}>Prevent part of the problem from happening again by changing the reg key that governs the size of temp internet files to a more reasonable size. [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
ioliver Posted August 5, 2005 Author Share Posted August 5, 2005 Prevent part of the problem from happening again by changing the reg key that governs the size of temp internet files to a more reasonable size.<{POST_SNAPBACK}>Is the reg key global (applies to the whole computer)? Or is it User based? Because we set Internet Explorer to only use 3 mbs for Temporary Internet Files, then copy the profile that we made the change in to the Default User profile, but, we still end up with large temp inet files directories.Thanks for the suggestion,Ian "Blessed be the name of the Lord" - Job 1:21Check out Search IMF Link to comment Share on other sites More sharing options...
herewasplato Posted August 8, 2005 Share Posted August 8, 2005 I do not know of a global key that can be set... I have tried to edit:HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Contentand then let a new user log on, but the cache was still huge... so, I reduced it manually.I cannot say that I fully understand how different sections of the registry mirror each other. Read page 11 of this document: http://www.ti-aalst.be/files/ti2_besturing...try_556_pgs.pdfIf you are going to be running a script on various systems - see if you can find that magic key to prevent too many temp inet files.later.... [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now