Thursday, January 16, 2014

Use UNC path as location for Attached Documents in Maximo 7.5

Use a network location (UNC Path) as Attached Documents location in Maximo on Windows Server 2012. 

When configuring a attached documents configuration Maximo needs a drive letter. This drive letter can be linked to a UNC path where the documents should be stored.

However, the mapping is not available when the user is logged off from the server after a reboot for example.

Create a Windows Service that will create a drive mapping. This way the drive is available when the server starts.

I did this on a Windows Server 2012 environment with Maximo

Step 1. Create a Windows Service that will map the UNC path to a drive letter.

I use the 'Non Sucking Service Manager' tool to create a service. Great name :) 

The service will execute a batch file which in return will first delete the network mapping and the create it again.

You can download the tool here:

Next i create a bat file in which the mapping is deleted and then created again.

net use e: /DELETE /YES


Fill in the appropriate values so it matches your environment. When I navigate to the FILESERVER01\Maximo\Test make sure there is a folder DOCLINKS7, you will see it in Step 2.

I save the bat file as autoexnt.bat, you could name it anyway you like.

Next, open a dosbox as an Administrator and navigate to the location of the nssm tool.

Then type:  nssm install Mapping
Note that 'Mapping'  is the name of the Service you can name it anyway you like. A dialog will open.

Now choose the created batch file in the Path option. You can also change the name of the service again here.

Now go to the Exit actions tab in the nssm tool and at the Restart dropdownbox, choose 'No action (srvany compatible)' This will prevent the service from keep trying to delete and make the mapping it it fails.

Click on the 'Install service' button to create the Service.

Open the Services.msc and check the Service. Make sure it is set to the 'Automatic' Startup Type

Next we open the IBM HTTP Server 7.0 Service ans set the Startup type to 'Automatic (Delayed Start)'

This is needed to make sure the Mapping service has created the mapping before the webserver that serves the Maximo documents is starting up. 

Now we have a mapping ready for us whenever the server is running and after a reboot the mapping will be created even if no user logs on to the server.

Step 2. Webserver configuration.

Now we need to configure Maximo to use the Mapping, this is standard Doclnks configuration, but i will post it here anyway, just to show you it works :)

I run a Notepad ++ as Administrator and navigate to D:\ibm\HTTPServer\conf. I open the httpd.conf file (make sure you create a backup first)

On line 221 modify the DocumentRoot like so:

# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#DocumentRoot "D:/IBM/HTTPServer/htdocs"
DocumentRoot "E:\DOCLINKS7"

on line 249 modify the Directory like so:
# This should be changed to whatever you set DocumentRoot to.
#<Directory "D:/IBM/HTTPServer/htdocs">
<Directory "E:\DOCLINKS7">

Here is an overview of the file:

Save the httpd.conf and close the Notepad ++

Step 3. Configure Maximo.

Like in step 2 this is also standard Maximo Doclinks configuration.

I modify the following properties in the System Properties:

mxe.doclink.doctypes.defpath  ->  E:\DOCLINKS7
mxe.doclink.doctypes.topLevelPaths  ->  E:\DOCLINKS7

and the following property:

mxe.doclink.path01  ->  E<PATH>\DOCLINKS7 = http://MaximoServerName/

where the MaximoServerName if the name of your Maximo server.

You can also set the mxe.doclink.path01 in the file, this can be nice when rolling back databases.
That would look like this:

And finally you set the Folders in each application that uses Attached Documents in Maximo.

Step 4. Completing.

Now rebuild and redeploy Maximo.

When finished, reboot the server completely to test everything.

When logged on on the server you will see the drive as a 'Disconnected Network Drive' 
This is normal, and when you click on it, it should show the content of the folder.

So there you have it, a UNC path as a Doclinks location.