Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

User profile Size Report

Posted on 2016-11-18
3
83 Views
Last Modified: 2016-11-21
Does anyone know of a script that will do the following. User can run the script themselves but we need to report back their profile sizes or anywhere there are documents stored on the machine, for example some users could have documents stores elsewhere or My Documents mapped differently.

Anyway, what i am looking for is a script that the users can run by clicking, this will then scan their machine and create a CSV in their logon name showing the directory of their profile and size back to a remote location.

Thanks in Advance

John
0
Comment
Question by:John Davies
3 Comments
 
LVL 24

Expert Comment

by:NVIT
ID: 41893889
> ...some users could have documents stores elsewhere

Does this mean the script must check the user's entire c: drive? Also at possibly random locations?
0
 
LVL 25

Accepted Solution

by:
Coralon earned 500 total points
ID: 41893901
Do you have a list of what you are looking for (specifically file extensions, and what details you want in your CSV file?)
Obviously, your remote location will need to let the users have access..  but, something like this would work for you.. )

Your base reporting script would be something like this: maybe something like c:\Reports\New-ProfileReport.ps1
$TxtSize = 0
$XlsSize = 0
$PPTSize = 0
$DocSize = 0
$XlsxSize = 0
$PPTxSize = 0
$DocxSize = 0

$Files = get-childitem -path $env:userprofile -recurse -include *.txt,*.xls,*.ppt,*.doc,*.docx*.xlsx,*.pptx
$files | where-object { $_.name -like '*.txt' } | foreach-object { $TxtSize += $_.length }
$files | where-object { $_.name -like '*.xls' } | foreach-object { $XlsSize += $_.length }
$files | where-object { $_.name -like '*.ppt' } | foreach-object { $PPTSize += $_.length }
$files | where-object { $_.name -like '*.doc' } | foreach-object { $DocSize += $_.length }
$files | where-object { $_.name -like '*.xlsx } | foreach-object { $XlsxSize += $_.length }
$files | where-object { $_.name -like '*.pptx' } | foreach-object { $PPTxSize += $_.length }
$files | where-object { $_.name -like '*.docx' } | foreach-object { $DocxSize += $_.length }
$Output = "Size of Text Files: $($TxtSize/1KB) kb"
$Output += "Size of Xls Files: $($XlsSize/1KB) kb"
$Output += "Size of PPT Files: $($PPTSize/1KB) kb"
$Output += "Size of Doc Files: $($DocSize/1KB) kb"
$Output += "Size of Xlsx Files: $($XlsxSize/1KB) kb"
$Output += "Size of PPTx Files: $($PPTxSize/1KB) kb"
$Output += "Size of Docx Files: $($DocxSize/1KB) kb"
$Output += "TotalSize: $($TxtSize + $XlsSize + $PPTSize + $DocSize + $XlsxSize + $PPTxSize + $DocxSize)"
$Output += "`r`n`r`n"
$Output += ($files | select-object -property Name,FullName,CreationTime,LastWriteTime,Length | convertto-csv -notypeinformation)
$Output | out-file -encoding ascii -filepath "\\server\share\$([datetime]::now.tostring('yyyy-MM-dd'))_$env:username`_ProfileDirectoryFiles.csv" 

Open in new window


Then you will put together a small script to run it.. even just a batch file.. something like this: c:\Reports\RunMyProfileReport.cmd
@echo off
powershell.exe -noprofile -noninteractive -file c:\Reports\New-ProfileReport.ps1

Open in new window


You give the users a shortcut to the batch file (possibly changing directories as need be)

Coralon
0
 

Author Closing Comment

by:John Davies
ID: 41895877
Thanks for that, perfect!
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question