Manage user profiles
- This topic has 4 replies, 5 voices, and was last updated 2 years, 1 month ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Home › Forums › Scripting › PowerShell › Manage user profiles
Group,
I am not versed in PowerShell- still learning.
I need to manage Userprofiles on 1000+ computers.
I am starting small.
The end goal is to remotely delete User profiles (other than specials) over 5 days old)
This is the ‘rough’ goal
Get-WMIObject -class Win32_UserProfile -ComputerName ‘XXXXX’| Where {(!$_.LocalPath -like ‘**.*’) -and ($_.ConvertToDateTime($_.LastUseTime) -lt (Get-Date).AddDays(-5))} | Remove-WmiObject
(Get-WmiObject Win32_UserProfile -ComputerName ‘XXXXX’ | Where {($_.LocalPath -like ‘**.*’)}|)
This successfully enumerates all profiles that fit the pattern (firstname.lastname)
(Get-WmiObject Win32_UserProfile -ComputerName ‘XXXX’ | Where {($_.LocalPath -like ‘**.*’)}| Remove-WmiObject -whatif)
This lists all profiles that would be deleted- no errors
(Get-WmiObject Win32_UserProfile -ComputerName ‘xxxx
‘| Where {($_.LocalPath -like ‘**.*’)}| Remove-WmiObject)
This results in errors…. what am I missing?
You must be logged in to reply to this topic.
Find out more about our cookie policy here.