Monday, August 11, 2014

Script / Batch file to Delete the Pending.xml from multiple servers

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

Friday, August 8, 2014

Step by step process to extend the disk in Windows Server 2003 cluster

Hi,

Recently I was trying to increase the space in one of the share drive of Windows Server 2003 Cluster.
By default Disk management console does not allow to directly extend the drive.

After Googling I found the below solution for the same. Hope that it will help you too.
*) Backup the Drive which you want to extend
1) Extend the LUN from storage side.
2) Login to node which is having specified drive ownership and make sure that the free space is visible.
3) Open a command prompt, type diskpart, and then press ENTER.
4) At the DISKPART prompt, type list volume , and then press ENTER to display the existing volumes on the computer.
5) At the DISKPART prompt, type select volume <volume number>, and then press ENTER. Here volume number is the number of the volume that you want to extend. The volume has the unique name that you created in step 6. The volume is listed in the output of the list volume command.
6) At the DISKPART prompt, type extend, and then press ENTER to extend the partition into all of the available disk space to the end of the drive. Or, type extend size=<size> to extends the selected volume by size megabytes (MB).
7) Type exit, and then press ENTER to exit the command prompt.




And if still you are facing issue in extending the LUN then follow below procedure.
 Process for Extension :
1) Backup the Drive which you want to extend
2) Extend the disk from SAN Storage
3) Shutdown one node in cluster.
4) Login to another node.
5) Open the Disk Management snap-in, verify that the new free space is added to the end of the proper drive.
6) Open a command prompt, type diskpart, and then press ENTER.
At the DISKPART prompt, type list volume , and then press ENTER to display the existing volumes on the computer.
At the DISKPART prompt, type select volume <volume number>, and then press ENTER. Here volume number is the number of the volume that you want to extend. The volume has the unique name that you created in step 6. The volume is listed in the output of the list volume command.
At the DISKPART prompt, type extend, and then press ENTER to extend the partition into all of the available disk space to the end of the drive. Or, type extend size=<size> to extends the selected volume by size megabytes (MB).
Type exit, and then press ENTER to exit the command prompt.




Hope this helps you.

Tuesday, August 5, 2014

Error in running SQL Query having VBScript and Excel Containers

Error 1 :  Event ID 10016 DistributedCOM
The machine-default permission settings do not grant Local Activation permission for the COM Server application with CLSID
{00024500-0000-0000-C000-000000000046}
 and APPID
{00020812-0000-0000-C000-000000000046}
 to the user NT AUTHORITY\NETWORK SERVICE SID (S-1-5-20) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.



Error 2 : Microsoft VBScript Runtime Error: Permission Denied 'CreateObject'
Error 3 :


Solution : 
1) Open Component Services.

2) Add Local Launch and Local Activation permission to Network Service Account (Or whichever is getting used by SQL Server to execure the SQL Query. In our case SQL Services are running via Network Service Account) on Microsoft Excel Application (Component Services > Computer > My Computer > DCOM Config)



3) Under Identity Tap, select "The Interactive User"

Thats it. You are ready to execute your command from SQL Server.

Let me know about you view on this article. Please comment if you have any query.

Solved : The user profile failed to attach. The process cannot access the file becase it is being used by another process

Issue :  The user profile failed to attach. Please contact Support. Status : 0x0000000B, Message: Cannot open virtual disk Error Code: 0x000...