Solved

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

Posted on 2014-09-18
11
437 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
  • 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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
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…

758 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

23 Experts available now in Live!

Get 1:1 Help Now