Friday, July 22, 2011

How App-V works?




Click on the image to enlarge

· When a user logs on to a device that has one of the clients (either App-V Terminal Services or Desktop Client) installed, the client sends a request to the server for a list of applications assigned to the current user.


· The server communicates with Active Directory to determine which groups the user is a member of and then returns the list of applications back to the client.

· The client begins building advertisements for the virtual applications that have been assigned to that particular user.

· In this publishing phase the below files are created in the client machine:
  •  Microsoft Application Virtualization-enabled application (.sft) file.
  • One or more Open Software Description (.osd) "link" files
  • One or more icon (.ico) files
  • Microsoft Application Virtualization project (.sprj) file. 
· The icons, instead of pointing to executables that reside in the program files directory, point to the App-V client, which relies on a launcher file (an OSD file) for its configuration.

· When the user launches a virtual application, the client reads an OSD configuration file, which has been stored on the local machine.

· This tells the client which protocol to use when communicating with the App-V management server and on which server the application resides.

· The appropriate server responds to the client by streaming down the initial launch threshold, which is typically 20–40 percent of the full application.

· Once the entire launch threshold has been streamed (again, just 20–40 percent of the application), the virtual application is ready to run.

· The streaming really is one of the key elements that can send just enough of an application so that it can run without wasting valuable network bandwidth.

· All the data being delivered to the client resides in a local cache file on the device and any subsequent launches of the application are launched from the local cache, eliminating additional network traffic.

· Once the virtual application is finished streaming, the client builds an isolated environment that prevents the application from altering the local machine.

· The client allows the virtual application to access the local file system when saving and editing files, and it also allows the application to interact with local services (such as printing) as long as the user has the appropriate privileges on the local system.

· But any changes made by a virtual application to the local system's files and registry are redirected to the virtualized environment so the host device will remain unaltered.

· When the application is being run, any features that haven't been used previously are delivered as needed and cached for subsequent use. The upside to this is that only components needed by the user are loaded on initial launch and features that aren't needed don't consume network resources.

· Consider Microsoft Office Word, for example. Almost all users use spell checker and therefore, it would be part of the initial launch. But not as many users use Help feature in Word, and, thus, it wouldn't need to be delivered in the initial launch. Instead, it would be sent to a user the first time he accesses it.

· When the user is finished and closes the application, the client tears down the virtual environment and stores all the user settings in a user-specific location so the environment can be retained and rebuilt upon next launch.

· Whatever percentage of the virtual application that had been streamed remains in the local cache and is available for the next launch. And if another user logs onto the same host system and launches the same virtual application, the new user benefits from the application already stored in the cache.

· To remove the virtual application advertisements, simply remove the user from the appropriate Active Directory group.

· To uninstall the virtual application from a desktop completely, you can simply clear the cache. Since the application was never really installed locally, there are no annoying prompts asking, "Do you want to remove this shared component?"

· Even if a virtual application is stored in the cache, that doesn't mean all users have access to it. Unlike locally installed applications where users can simply search or browse for executables that they don't have rights to, there are no visual or physical representations that the virtual application exists unless the user has been given explicit rights to it through Active Directory groups.

*************************************************

VBScript to copy a file from Source directory

The below script is used to copy "vpnclient_setup.msi file" from the Source directory to "[ProgramFilesFolder]Cisco Systems\Install\", if the directory exists and if it doesn't exists, this script will create a folder named "Install" and will copy the file. This is achieved by declaring "SOURCEDIR" as a session property and copying from there.

Note: This script should be placed at the end of the "Execute Immediate" sequence for it to work.

*************************************************

Dim objfso,wshshell,str

Set wshshell = createobject("wscript.shell")

PF = wshshell.expandenvironmentstrings("%ProgramFiles%")

Set objFSO = CreateObject("Scripting.FileSystemObject")

str = Session.Property("SOURCEDIR")

Set oFile1 = objfso.GetFile(str & "\vpnclient_setup.msi")

If objfso.FolderExists(PF & "\Cisco Systems\Install") Then

objFSO.CopyFile oFile1, PF & "\Cisco Systems\Install\", True

Else

Set objFolder = objFSO.CreateFolder (PF & "\Cisco Systems\Install")

objFSO.CopyFile oFile1, PF & "\Cisco Systems\Install\", True

End If

*************************************************

VBScript for silent merge of a registry file

Set WshShell = CreateObject( "WScript.Shell" )


PF=WshShell.ExpandEnvironmentStrings("%ProgramFiles%")

wshshell.Run "REGEDIT /s " & Chr(34) & PF & "\QuickTime\FileCap.reg" & Chr(34), 0, True

**********************************************

VBScript to Stop and Start a service

To Stop a Service:
-------------------

strComputer = "."


strServiceName = "CVPND"

Set a= GetObject("winmgmts:\\" & strComputer)

Set b = a.ExecQuery("Select * from Win32_Service Where Name ='" & strServiceName & "'")

For Each c in b

c.StopService()

Next

 
To Start a Service:
-------------------
 
strServiceName = "CVPND"


Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set colListOfServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='" & strServiceName & "'")

For Each objService in colListOfServices

objService.StartService()

Next

***********************************************