Monday, June 27, 2016

Oracle WebLogic11g/12c does not have access on network drive mapped on Windows

There are some issues with WebLogic instances started as services on wirdows where there are some network drivers mapped to our Windows System.
To solve this issue we have to map the network driver as a service in Windows. To do that we have to follow this steps.

Step #1. Copy this srvany.exe to "c:\windows\system32".
Step #2. Create the following files: MyService.bat, MyServiceInstall.bat and MyService.reg.

#Where the content of MyService.bat is:

@echo off
echo -----------------------------------------------------------
net use X: /delete
net use X: \\my.windows.server.oracle.com\your_share_driver /persistent:yes
net use Y: /delete
net use Y: \\my.windows.server.oracle.com\your_share_driver /persistent:yes

echo Done at  %date% %time%

#replace "my.windows.server.oracle.com" with IP of the server or even server name.
#replase also "your_share_driver" with the folder shared from your server "my.windows.server.oracle.com".

#Where the content of MyServiceInstall.bat is:

@echo off

echo ---------------------------------------
echo Create MyService
echo ---------------------------------------
sc create MyService binPath= "C:\Windows\System32\srvany.exe" DisplayName= "MyService"

echo ---------------------------------------
echo Create registry entry
echo ---------------------------------------
call MyService.reg

#Where the content of MyService.reg is:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyService]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):43,00,3a,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,\
  5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,72,00,76,\
  00,61,00,6e,00,79,00,2e,00,65,00,78,00,65,00,00,00
"DisplayName"="MyService"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\MyService\Parameters]
"Application"="C:\\MyService\\MyService.bat >> C:\\MyService\\MyService.log"

Step #3. Execute the the file in cmd MyServiceInstall.bat.