r/PowerShell • • May 26 '24

Hello i deleted default powershell from system32 labeled 1.0 can i somehow restore it without reinstaling windows ?

0 Upvotes

22 comments sorted by

48

u/BlackV May 26 '24

why are you touching ANYTHING in windows or windows\system32 (actually I'm surprised Amazed! it actually let you do that in the first place)

you want /r/techsupport or /r/windows

1

u/tryharder123456789 Aug 25 '24

Wow so need for a reddit power shell subreddit------------ OK everyone no matter what your question about power shell don't go to the r/PowerShell

you want r/techsupport or r/windows

1

u/BlackV Aug 25 '24

I mean its not a poweshell question, if they deleted mspaint, should they ask the ask the same question in /r/mspaint or cmd in /r/cmd?

in this case the solutions is not powershell cause they deleted powershell, so its restore from backup or reinstall windows

ignoring that this was 3 month ago mind you

1

u/tryharder123456789 Aug 25 '24

If they deleted a paint config file that a user is expected to edit then I would say yes its a ms paint question

OP was able to edit the file by clicking a button within powershell so yes it is a powershell question

1

u/BlackV Aug 25 '24

no if they deleted mspaint (the executable) or cmd (the executable) your container product is windows

powershell is (in theory) gone, there is not a powershell command they can run to restore that

From OP (Alskaeer163)

Thanks I'll just reinstall windows

and

ganlet20
First run: DISM /Online /Cleanup-Image /RestoreHealth
Then: sfc /scannow

OP (Alskaeer163)
It worked thanks a lot dude

none of which is powershell but is basic /r/techsupport or /r/windows and solved their problem

-25

u/Alskaeer163 May 26 '24

I opened sketchy bat file which added some files in 1.0, i tinkered with administrator permissions and deleted 1.0 when i realized that was PowerShell it was too late

45

u/BryanP1968 May 26 '24

If you opened something “sketchy” then no. Wipe the PC and start over. Though if you deleted anything in System32 you should call / pay someone who knows what they’re doing.

29

u/jrodsf May 26 '24

Try:

sfc /scannow

In an elevated command prompt.

28

u/ganlet20 May 27 '24

First run:

DISM /Online /Cleanup-Image /RestoreHealth

Then

sfc /scannow

1

u/Alskaeer163 May 28 '24

It worked thanks a lot dude

18

u/fungusfromamongus May 26 '24

I love the honesty around sketchy bat file.

11

u/gordonv May 26 '24

Check this out.

But like /u/ollivierre said, you should probably just blow it away with a reinstall. Backup your important files or use something like Acronis to do a full backup to an external HDD.

Blowing away an install not only fixes the problem at hand, but fixes edge cases you were not aware of.

1

u/Alskaeer163 May 26 '24

Thanks I'll just reinstall windows

2

u/xbullet May 27 '24

If you suspect you might have picked up some malware, this is the safest option.

3

u/xtheory May 26 '24

What were the contents of said sketchy batch file? Would be good to know to determine if it was malicious? You can right click it and select Edit.

2

u/ollivierre May 26 '24

Treat them like cattle not like pets. but you could technically Copy it from another machine is probably the easiest.

1

u/iwinsallthethings May 27 '24

Treating them like cattle does not mean put it down at first sign of sickness. Treat if easy, then put down.

1

u/_BL810T May 27 '24

Would an in place upgrade not work? Get a windows iso on a usb and run the setup from inside your OS

1

u/StConvolute May 27 '24

You could try removing the PowerShell features and reinstalling them? Otherwise I'd be looking as reading up on DISM commands, maybe use that as a feature install path?

1

u/Lonely_Ad8964 May 27 '24

Don't simply reinstall windows. Wipe the drive using the BIOS tool and then reinstall windows from DVD