?
Solved

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

Posted on 2014-09-18
11
Medium Priority
?
455 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
Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

765 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