Solved

User profile Size Report

Posted on 2016-11-18
3
132 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
[X]
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
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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
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…

623 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