Solved

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

Posted on 2014-09-18
11
441 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
Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

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

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.

Question has a verified solution.

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

If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Synchronize a new Active Directory domain with an existing Office 365 tenant
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…
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…

912 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

21 Experts available now in Live!

Get 1:1 Help Now