Solved

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

Posted on 2014-09-18
11
453 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
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
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.
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.

729 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