2

On a Windows Server 2012R2 environment, is the PowerShell cmdlet rm undoable? The TechNet manual for Remove-Item states that it deletes an item (multiple types), but no specification about the possibility of undeleting the item.
So, if I do

rm .\filename.ext

from a PowerShell prompt, can I recover this file only using native tools?

  • Only reversible using a mirror. – Daniel R Hicks May 9 '14 at 21:43
  • Why do you want to do this? If you don't want to permanently delete something, can't you just rename it or move it somewhere? – dangph May 12 '14 at 0:56
8

I will answer even thought never used Power Shell.

Per the manual,

it says:

Delete the specified items.

Thus, at this point your question narrows down to:

Can I recover deleted file?

You can, but it is not something that you do from right click context menu.

File is not physically disappearing from the partition upon deletion. It's content remains there but being marked as free space. If this data is not overwritten by other data, than you can recover the files. There are various products which can help to do it.

One of them is free open source System Rescue CD.

Edit:

Here is an analogy of reverting rm command in real word with real objects:

Imagine following: You dropped a bottle of milk and it cracked - milk is all over the floor.

You know how to get milk out of the floor and put it back to different bottle. (For this example let's assume the milk is not intended for drinking - it is just content of the bottle).

But now you are asking me "How to cancel the drop action"? You can not cancel the drop action. Bottle was dropped and you can not "undrop" it. Milk is on the floor.

Your only solution - get milk off the floor back to different bottle before your dog will take care of it.

  • Not really the answer I was looking for. I know how to recover deleted files that way. I am more interested if rm has a "simple" way to be reversed. – slybloty May 9 '14 at 20:54
  • 2
    @slybloty no. 3d party tools are the only way to go – EkriirkE May 9 '14 at 21:03
  • 1
    @slybloty, Well imagine following: You drop a bottle of milk and it cracked - milk is all over the floor. You know how to get milk out of the floor and put it back to different bottle. But now you are asking me "How to cancel the drop action"? You can not cancel the drop action. Bottle was dropped and you can not "undrop" it. Milk is on the floor. Your only solution - get milk off the floor back to different bottle. – VL-80 May 9 '14 at 21:07
  • Interesting analogy. – slybloty May 9 '14 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.