Helo, guys!
I need to be able to delete all user's profiles on all workstations in case of emergency. I have read similiar topics, but don't think it's suitable for me, so I need some help.
All workstations are working under Win7Pro, so I want to use PowerShell for this duty and I think I can use New-PSSession cmdlet to establish sessions to all my workstations, after that I need to log off users and delete profiles.
I tried to delete a profile at my localhost with next command:
( Get-WmiObject -Class Win32_UserProfile | Where-Object { $_.LocalPath -eq 'c:\users\user' } ).Delete()
but get an exception: Exception calling "Delete" with "0" argument(s)
I thought this method needs some args, but I couldn't find its definition or syntax neither with Get-Member, nor at MSDN. Can you point me - what does this error mean?
By the way - is there an easy way to log off users from system with PowerShell?
Thanks for all replies!