Solved

User profile Size Report

Posted on 2016-11-18
3
36 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 23

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 23

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker 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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now