Hey,
Many windows servers generates Pending.xml file due to inconsistent windows updates. Due to this file, future windows updates does not get installed.
Manually deleting Pending.xml is a huge task as it has multiple steps, e.g. taking ownership of file. Adding full permissions to particulate user on that file, etc. So I thought to create a batch file which will reduce the time of administrator for this activity.
IMP : Make sure that you run this batch file with "Run As Administrator" and with the user who is having administrative permissions on the server.
Note1 : Change DOMAIN\User with the domain user with which you will delete the pending.xml file.
Note2 : Change SERVER1NAME, SERVER2NAME, etc with the server name where the pending.xml file is present.
Copy below text and save it in PENDINGXMLDELETE.BAT file.
Have a Great Day Ahead!!!
REM Batch File Start
SET PSNO=DOMAIN\User
SET SERVER1=SERVER1NAME
SET SERVER2=SERVER2NAME
SET SERVER3=SERVER3NAME
SET SERVER4=SERVER4NAME
SET SERVER5=SERVER5NAME
SET SERVER6=SERVER6NAME
takeown /f \\%SERVER1%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER1%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER1%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER2%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER2%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER2%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER3%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER3%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER3%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER4%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER4%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER4%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER5%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER5%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER5%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER6%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER6%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER6%\c$\Windows\WinSxS\pending.xml
REM Batch File End
Many windows servers generates Pending.xml file due to inconsistent windows updates. Due to this file, future windows updates does not get installed.
Manually deleting Pending.xml is a huge task as it has multiple steps, e.g. taking ownership of file. Adding full permissions to particulate user on that file, etc. So I thought to create a batch file which will reduce the time of administrator for this activity.
IMP : Make sure that you run this batch file with "Run As Administrator" and with the user who is having administrative permissions on the server.
Note1 : Change DOMAIN\User with the domain user with which you will delete the pending.xml file.
Note2 : Change SERVER1NAME, SERVER2NAME, etc with the server name where the pending.xml file is present.
Copy below text and save it in PENDINGXMLDELETE.BAT file.
Have a Great Day Ahead!!!
REM Batch File Start
SET PSNO=DOMAIN\User
SET SERVER1=SERVER1NAME
SET SERVER2=SERVER2NAME
SET SERVER3=SERVER3NAME
SET SERVER4=SERVER4NAME
SET SERVER5=SERVER5NAME
SET SERVER6=SERVER6NAME
takeown /f \\%SERVER1%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER1%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER1%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER2%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER2%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER2%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER3%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER3%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER3%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER4%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER4%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER4%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER5%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER5%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER5%\c$\Windows\WinSxS\pending.xml
takeown /f \\%SERVER6%\c$\Windows\WinSxS\pending.xml
cacls \\%SERVER6%\c$\Windows\WinSxS\pending.xml /G %PSNO%:F
del \\%SERVER6%\c$\Windows\WinSxS\pending.xml
REM Batch File End