Beruflich Dokumente
Kultur Dokumente
This article describes how to run scripts in an .osd file in Microsoft App-V (SoftGrid). You must be an App-V (SoftGrid) administrator to run a script. You can run any number of scripts and any style of scripts in an .osd file. You can run scripts to overcome some limitations of programs. Or, you can use scripts to set up particular configurations that a program may require to run correctly. You can pass a script that is written in almost any language from the .osd file of an App-V (SoftGrid)-enabled program to a client that has the necessary interpreter installed. Organizations may have preexisting scripts that are written by using Microsoft Visual Basic, Perl, .bat files, .cmd files, or other similar files. If you follow the basic rules of scripting that are required in an .osd file, you can continue to use the existing scripts. To include a script in an .osd file, you must determine the following: When the script runs Where the script runs How the script runs
MORE INFORMATION
General rules
All scripts must be added between the <DEPENDENCY> tags in an .osd file. You can refer to an existing script by its file name. Or, you can enter the exact syntax of the commands in the script section.
Notes
The client does not support a pre-shutdown event. You cannot determine the exact moment at which a user will perform a shutdown. For example, you cannot predict when the user will click Close or when the user will press ALT+F4. You can use scripts in any language. However, the language must be installed locally on the client computer.
Sample scripts
The following sample scripts show you how to use scripts in an .osd file.
Sample script 1
This sample script does the following: It uses the SCRIPTBODY tag to contact a server by using its IP Address. It deletes a drive mapping, and then it creates a new drive mapping by using the same drive letter.
<DEPENDENCY> <SCRIPT TIMING="PRE" EVENT="LAUNCH" WAIT="TRUE" PROTECT="TRUE"> <SCRIPTBODY> @echo on \n ping 192.168.100.100 \n net use x: /delete /y \n net use x: \\\\ServerName \\Achieve \n net use y: /delete /y \n net use y: \\\\ServerName\\Achieve\\claims\\Bethany \n </SCRIPTBODY> </SCRIPT> </DEPENDENCY>
Sample script 2
This sample script does the following: It uses the SCRIPTBODY tag to map a network drive to a server's netlogon share. It calls an existing .cmd file that is located on the mapped network drive. It calls the Editini.exe file. It adds a Temp path to the Word.ini file.
DEPENDENCY> <SCRIPT EVENT="LAUNCH" TIMING="PRE" PROTECT="TRUE" WAIT="TRUE"> <SCRIPTBODY> net use k: \\\\w2kpdc\\netlogon \n CALL k:\\usrw2k.cmd \n \\\\sftsoftgrid \\shr\\editini.exe c:\\word\\word.ini "FileLocations" TempPath c:\\tem \n </SCRIPTBODY> </SCRIPT> </DEPENDENCY>
Sample script 3
This sample script does the following: It uses the %SFT_MNT% variable to refer to the clients virtual mount point. This variable is typically Q:\. It calls the Proflwiz.exe program. The absolute path is used because the App-V (SoftGrid) mount point is typically not part of the clients path statement.
<DEPENDENCY> <SCRIPT TIMING="PRE" EVENT="LAUNCH" WAIT="TRUE" PROTECT="TRUE"> <SCRIPTBODY>%SFT_MNT%\\OfficeXP\\Office10\\proflwiz.exe</SCRIPTBODY> </SCRIPT>
REFERENCES
For more information about Microsoft App-V, visit the following Microsoft Web site: /appv/default.mspx (http://www.microsoft.com/systemcenter/appv/default.mspx)
http://www.microsoft.com/systemcenter
APPLIES TO
Keywords: kbscript kbexpertiseadvanced kbhowto KB939085
2011 Microsoft