Pages

Thursday, 21 June 2012

AppV OSD Script Example


This 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: \\\\w2k-pdc\\netlogon \n
CALL k:\\usr-w2k.cmd \n
\\\\sft-softgrid\\shr\\editini.exe c:\\word\\word.ini "FileLocations" TempPath c:\\tem \n
</SCRIPTBODY>
</SCRIPT>
</DEPENDENCY>

App-V 5.0 Beta: No more OSDs?

The publishing process no longer points to App-V client launcher program (sfttray.exe).  


Now in AppV 5.0, The shortcut points to actual exe, hence OSDs are not required.

App-V Client Offline Mode Settings


Following registries needs to be changed on App-V Client systems to run AppV client in Standalone/Offline modde

On 32bit machines the registry path is HKLM\SOFTWARE\Microsoft\SoftGrid\4.5\Client


On 64bit machines the registry parth is
HKLM\SOFTWARE\Wow3264Node\Microsoft\SoftGrid\4.5\Client


The settings required are:


HKLM\...\Configuration AllowIndependentFileStreaming 1
HKLM\...\Configuration RequireAuthorizationIfCached 0
HKLM\...\Network AllowDisconnectedOperation         1
HKLM\...\Network LimitedDisconnectedOperation 0

Custom Action Conditions in MSI


You can execute a custom action or make the component install using conditions as per the requirement.
  1. Condition for Action to run only during Installation
    Condition: NOT Installed
  2. Condition for Action to run only during Uninstallation/Removal of MSI
    Condition: REMOVE="ALL"
  3. Condition for Action to run during Install and repair
    Condition: NOT REMOVE
  4. Condition for Action to run only during Upgrade
       Condition: NOT UPGRADINGPRODUCTCODE

Append Entries to Hosts file


Following script can be used to append entries in HOSTS file.
A text file containing the entry to be appended should be placed in INPUT location as in below script

Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim TargetFile,objWshShell,objFSO, Input, ProgramFiles, WinDir
Dim objTextFile, Target
Set objWshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ProgramFiles = ObjWshShell.ExpandEnvironmentStrings("%ProgramFiles%")
WinDir = ObjWshShell.ExpandEnvironmentStrings("%WinDir%")
Set Targetfile = objFSO.GetFile(WinDir & "\system32\drivers\etc\hosts")
Set Input = objFSO.GetFile(ProgramFiles & "\Input.txt")

Set objTextFile = objFSO.OpenTextFile (Input, ForReading)
Set Target = CreateObject("Scripting.FileSystemObject")
Set TargetFile = Target.OpenTextFile (TargetFile, ForAppending, True)
Do Until objTextFile.AtEndOfStream
Input = objTextFile.ReadLine
TargetFile.WriteLine(Input)
Loop
TargetFile.Close
ObjTextFile.Close
objFSO.DeleteFile(ProgramFiles & "\Input.txt")

VBScript to find MAC Address of a machine


VBScript to find the MAC Address of Network Adaptors attached to a computer.

On Error Resume Next
Dim strComputer
Dim objWMIService
Dim colItems

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

Set colItems = objWMIService.ExecQuery _
    ("Select * from Win32_NetworkAdapterConfiguration")

For Each objItem in colItems
    Wscript.Echo "MAC Address: " & objItem.MACAddress
Next

Set Permissions using SetACL


Using SetACL to provide permissions

Command1: Providing registry permissions to Authenticated Users group

setacl.exe "MACHINE\SOFTWARE\AHouse\GEPUIS ORBIX" /registry /grant "Authenticated Users" /full /i:cont_obj_inh /p:yes /r:cont_obj /silent

OR using S-ID

"MACHINE\SOFTWARE\AHouse\GEPUIS ORBIX" /registry /set "S-1-5-11" /full /sid /silent

Command2: Providing Folder permissions to Authenticated Users group

setacl.exe "c:\AudioTools\GIMP" /dir /set "S-1-5-11" /change /sid /silent

Change the group name / S-ID according to your requirement