Have you been looking for a way to replace all instances of notepad.exe on Windows Server 2008? If so, here is a quick and dirty batch file to help you out.
Note: I ran a “dir /s /b notepad.exe > replace_notepad.cmd” to get a list of copies of notepad.exe on the c drive, then edited the new file with what is below
@echo off echo Create Backup copies of the original notepad.exe copy C:Windowsnotepad.exe C:Windowsnotepad32.exe copy C:WindowsSystem32notepad.exe C:WindowsSystem32notepad32.exe copy C:WindowsSysWOW64notepad.exe C:WindowsSysWOW64notepad32.exe echo Take Ownership of the files rem This could be changed to use icacls now takeown /F C:Windowsnotepad.exe /A takeown /F C:WindowsSystem32notepad.exe /A takeown /F C:WindowsSysWOW64notepad.exe /A takeown /F C:Windowswinsxsx86_microsoft-windows-notepadwin_31bf3856ad364e35_6.0.6001.18000_none_42c9ccdefb0d0dc9notepad.exe /A takeown /F C:Windowswinsxsx86_microsoft-windows-notepad_31bf3856ad364e35_6.0.6001.18000_none_6f1a8d7b6fffbb73notepad.exe /A takeown /F C:Windowswinsxsamd64_microsoft-windows-notepadwin_31bf3856ad364e35_6.1.7600.16385_none_9ebebe8614be1470notepad.exe /A takeown /F C:Windowswinsxsamd64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_cb0f7f2289b0c21anotepad.exe /A takeown /F C:Windowswinsxswow64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_d5642974be118415notepad.exe /A echo Assign full rights to the administrators group icacls c:windowsnotepad.exe /grant Administrators:F icacls C:WindowsSystem32notepad.exe /grant Administrators:F icacls C:WindowsSysWOW64notepad.exe /grant Administrators:F icacls C:Windowswinsxsx86_microsoft-windows-notepadwin_31bf3856ad364e35_6.0.6001.18000_none_42c9ccdefb0d0dc9notepad.exe /grant Administrators:F icacls C:Windowswinsxsx86_microsoft-windows-notepad_31bf3856ad364e35_6.0.6001.18000_none_6f1a8d7b6fffbb73notepad.exe /grant Administrators:F icacls C:Windowswinsxsamd64_microsoft-windows-notepadwin_31bf3856ad364e35_6.1.7600.16385_none_9ebebe8614be1470notepad.exe /grant Administrators:F icacls C:Windowswinsxsamd64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_cb0f7f2289b0c21anotepad.exe /grant Administrators:F icacls C:Windowswinsxswow64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_d5642974be118415notepad.exe /grant Administrators:F echo Copy new notepad.exeover the original versions copy /y C:notepad.exe C:Windowsnotepad.exe copy /y C:notepad.exe C:WindowsSystem32notepad.exe copy /y C:notepad.exe C:WindowsSysWOW64notepad.exe copy /y C:notepad.exe C:Windowswinsxsx86_microsoft-windows-notepadwin_31bf3856ad364e35_6.0.6001.18000_none_42c9ccdefb0d0dc9notepad.exe copy /y C:notepad.exe C:Windowswinsxsx86_microsoft-windows-notepad_31bf3856ad364e35_6.0.6001.18000_none_6f1a8d7b6fffbb73notepad.exe copy /y C:notepad.exe C:Windowswinsxsamd64_microsoft-windows-notepadwin_31bf3856ad364e35_6.1.7600.16385_none_9ebebe8614be1470notepad.exe copy /y C:notepad.exe C:Windowswinsxsamd64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_cb0f7f2289b0c21anotepad.exe copy /y C:notepad.exe C:Windowswinsxswow64_microsoft-windows-notepad_31bf3856ad364e35_6.1.7600.16385_none_d5642974be118415notepad.exe