0
I tried the following script on a Windows Server 2008 R2 to delete the User Profiles on a Windows 7 client machine.
PS C:\> get-content localcomputer-list.txt | get-userprofile | where {$_.LastUse 'lt (Get-Date).AddDays(-90)}} | remove-userprofile -whatif
It doesn't work.
How do I resolve this?
What are the results after running this? Are you getting any errors? Where does it fail to run? – paradd0x – 2015-07-21T18:59:55.587
it doesn't return anything and and even command doesn't run completely – kunal – 2015-07-21T19:15:54.970
after ruuning it. i get
>>
.when i run this command let Get-userporfile manully , i get the error cmdlet is not recozinized – kunal – 2015-07-21T19:17:18.990
If you get
>>
that is new line in Powershell console, it means that you didn't close a string somewhere or there is a pipe|
that has nothing on the right side (console thinks that there's something more to add). Btw. it should be-lt
not'lt
and you have double bracket afterAddDays(-90)
. My guess it's'lt
that causes it. – mwilczynski – 2015-07-21T23:32:37.440I use DelProf2 for this kind of task, just deleting the files usually doesn't work.
– Peter Hahndorf – 2015-07-22T11:40:17.603are you using DelProf2 in your production environment ? can we automated the Task – kunal – 2015-07-22T13:39:01.637