Solved

Report required on remote workstations local profiles (profile name, folder size & modified last date/time)

Posted on 2014-09-18
11
448 Views
Last Modified: 2014-09-20
I have 100 Windows 7 workstations, which I would like to ouput a report of the profiles on each.  In particluar I need the following information - Profile Name, Folder size (c:\users\%username%), Folder Size (My Documents), & last modified date.

I have been playing about with powershell, but I'm only a beginner & I'm not getting all the info back I'm looking for.  I do have the following however:

$profilelist = "HKLM:\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\ProfileList"
gwmi win32_userprofile | select @{LABEL="last used";EXPRESSION={$_.ConvertToDateTime($_.lastusetime)}}, localpath

Open in new window


When I run this powershell script locally on my workstation, it outputs the "Last Used" date, "Local Path" of all the profiles on my own workskation, although I've been struggling to get folder size added & how to report this info on a list of workstations.  It would be great if someone to help with this.

Thanks,
0
Comment
Question by:meepmaker
[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
  • 6
  • 5
11 Comments
 
LVL 40

Expert Comment

by:Subsun
ID: 40330573
Attached a script which I had used to report and remove old profile.. You can use the same for reporting..

Usage..
To report profile details of computers listed in computer.txt
.\Profiledelete-V1.ps1 -ReportOnly -computername (GC 'C:\temp\computer.txt')

Open in new window

To export the details to csv file
[embed=file 872937].\Profiledelete-V1.ps1 -ReportOnly -computername (GC 'C:\temp\computer.txt') | Export-csv C:\temp\report.csv -nti

Open in new window

Profiledelete-V1.ps1.txt
0
 

Author Comment

by:meepmaker
ID: 40330641
Thanks Subsun, I'll give that a shot.  Can I ask that if I use:

Profiledelete-V1.ps1 -ReportOnly -computername (GC 'C:\temp\computer.txt')

This definitely won't delete any profiles on the workstations, but just report them?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40330650
It wont delete the profiles when you use -ReportOnly parameter.. :-)
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

by:meepmaker
ID: 40330802
Hi Subsun,
This works really well with regards to getting info on multiple remote computers, but I still need info on the folders sizes for the profiles (C:\Users\%username% & C:\Users\%username%\My Documents) on each workstations
Any ideas?
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40330814
Getting the folder size may make the script very slow especially when you  going to run it against 100's of workstations..
0
 

Author Comment

by:meepmaker
ID: 40330848
Yes, I'm aware of that, but it's something I would run over a few days anyway. I kinda need to identify which profiles haven't been getting copied up to their network location since a change of server & share in the folder redirection policy a few weeks ago.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40330860
ok.. I will modify the code and post it here, as soon as I get a chance..
0
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 40331101
Try the attached code..
Profiledelete-V1.ps1.txt
0
 

Author Comment

by:meepmaker
ID: 40334594
Thanks Subsun, that works a treat.

If I want to use the delete profile function then I guess that I just run the following? :
Profiledelete-V1.ps1 -computername (GC 'C:\temp\computer.txt')

Where in the body of the script do I state the age profile should be before deletion?  i.e. if I wanted for example all profiles before 6th of Aug 2014 to be deleted from a list of workstations?

Thanks
0
 

Author Closing Comment

by:meepmaker
ID: 40334597
Great answer & responded very quickly to my question.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 40334658
Profiledelete-V1.ps1 -computername (GC 'C:\temp\computer.txt') will delete the profiles older than one day from the list of computers.

.\Profiledelete-V1.ps1 -computername ComputerA -days 30

Open in new window

Above code will delete the profiles older than 30 days from computer 'ComputerA' (or a list of computers)
To test the code you can use -WhatIf switch..
.\Profiledelete-V1.ps1 -computername ComputerA -days 30 -WhatIf

Open in new window

If not you can also use the report file as a input to delete the profiles..
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A brief introduction to what I consider to be the best editor for PowerShell.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

730 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