I have posted in the past a couple of post on how to use the Network Sap server to easily customize, patch and deploy the sap client in the enterprise, wether via Sccm or other deployment tools.

Since a lot of admins are now testing or moving to application virtualization, let’s have a look at how we can use the tool to ease our app-v repckaging process.

In order to install the Sap installation server, refer to the document on the SAP support site:

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/80f043df-b655-2d10-e9a4-bba6967de101

[If you need a step by step, post a comment here and I will post one on this blog when I find the time]

I based the changes for App-v repackaging on the following blog post  from Nicke Kallen (Viridis IT)

http://www.viridisit.se/eng/blog/?p=782

Once your server is installed, launch NwSapSetupAdmin.exe from the /Sapgui720/admin/setup folder

Go to the Packages tab, and create a package that contains the components you want to deploy (in my case, I just took the same components that I deploy on the computers)

Then select the ‘Configure Packages’ tab. Here we can adjust the deployment so that it matches the requirements of an App-v package.

The important steps here are:

Define Q drive path for SapBiDestDir and SapFrontEndDir. You can adjust them by clicking Modify Parameters

DO NOT FORGET to press SAVE to apply the changes.

I choose the Q:\Sap7201 folder, this is where my client will be installed.

The next step is to customize the deployment itself via SapScript

You can define scripts that the installer will run before, during and after Install (or Update)

(This scripting environment is based on vbscript, so it might look familiar to some of you)

The first thing to do is to define our Sap/Common folder on the Q: drive. We will use this folder to copy over files at the end of the deployment.

Select On Begin Install (you could as well create the directory in the On End Install tab, just make sure it exists before we copy the files)

and define the location in the same way it is done up here.

Note that the common files folder should preferably be a subfolder of your SapFrontEndDir directory,

The first line of the script simply defines the path, the second one executes the change.

Now move to the On End Install tab

[Here is the script I use in this tab]

NwEngine.Shell.SetRegValue “HKLM\SOFTWARE\SAP\SAPsetup\SAPstart\AutoUpdate\SAPLogon.exe\UpdateMode”, “REG_SZ”, “ForceOff”
strSrcFile1  = NwEngine.Variables.ResolveString(“%WinDir%\System32\librfc32.dll”)
strSrcFile2  = NwEngine.Variables.ResolveString(“%WinDir%\System32\SAPbtmp.dll”)
strSrcFile3  = NwEngine.Variables.ResolveString(“%WinDir%\System32\icuin34.dll”)
strSrcFile4  = NwEngine.Variables.ResolveString(“%WinDir%\System32\libsapu16vc90.dll”)
strDstFile1  = “Q:\SAP7201\SAP\Common Files\librfc32.dll”
strDstFile2  = “Q:\SAP7201\SAP\Common Files\SAPbtmp.dll”
strDstFile3  = “Q:\SAP7201\SAP\Common Files\icuin34.dll”
strDstFile4  = “Q:\SAP7201\SAP\Common Files\libsapu16vc90.dll”
NwEngine.Shell.CopyFile strSrcFile1, strDstFile1
NwEngine.Shell.CopyFile strSrcFile2, strDstFile2
NwEngine.Shell.CopyFile strSrcFile3, strDstFile3
NwEngine.Shell.CopyFile strSrcFile4, strDstFile4

NwEngine.Shell.DeleteFile strSrcFile1
NwEngine.Shell.DeleteFile strSrcFile2
NwEngine.Shell.DeleteFile strSrcFile3
NwEngine.Shell.DeleteFile strSrcFile4

OrgRegValue = “HKLM\System\CurrentControlSet\Control\Session Manager\Environment\Path”
targetValue = “C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;Q:\SAP7201\SAP\Common Files”
NwEngine.Shell.SetRegValue OrgRegValue, “REG_EXPAND_SZ”, targetValue

A small explanation here:  the first line disables automatic updates, lines 2 to 13 copy files from System32 to our sap\common files folder that we created in the former step and then deletes them from the original location.

The last part of the script adds our Common files folder to the PATH variables.

Note that since I use a virtual machine, I just took the default PATH reg key and added my common files path to it. This makes it much more simple. However, If you install other apps that will be used by the Sap Client, your path might be different, so always check it before repackaging.

Our package is now ready. The only thing to do now is to launch the repackager and run our package installation. The command can be found in the Properties tab of the Package.

You can remove /silent from the command if you want to see the dialog boxes and confirm what package you want to install.

There are a couple of benefits to using these tools:

– the install of the client is now fully automated, you don’t have to double check that each point has been done

– we use the same sources and patch versions for normal installation and V-app package since the same server is being used

– The patching of the client is easier, you just patch the server, redeploy the client which is now up to date, and deploy the changes to the virtual clients.

Note that I did not use this in production yet, so take usual precautions, this is only an example of what can be done.

Please post comments as your feedback is the best way to improve the information.

Advertisements