1. Home
  2. Docs
  3. Scense Embedded Scripting...
  4. Scense Native Scriptable ...
  5. App-V 5

App-V 5

The App-V object can be used to manipulate Microsoft Application Virtualization version 5 Applications. (For the App-V 4.x scriptable object see the previous chapter…)
The ‘Base’ object is ‘ScenseAppV5’. The ScenseAppV5 object provides general administrative functions.

ScenseAppV5

Properties Description
Applications Reference to the Applications collection
Packages Reference to the Packages collection
ConnectionGroups

 

Reference to the ConnectionGroups collection

 

Methods Description
AddAppvPublishingServer

 

Specify an App-V 5 publishing server for the client Requires admin-rights

Function AddAppvPublishingServer(url  as String , serverName  as String )  as Boolean
AddConnectionGroup

 

Create a new connection group of 2 or more Packages. This method accepts a collection of ‘PackageBrief’ objects. Requires admin-rights

Function  AddConnectionGroup(groupID  as String , versionID  as String , groupName  as String , priority  as long , Packages  as PackageBriefsCollection )  as Boolean
AddPackage

 

Add an App-V application package to the client. Requires admin-rights

Function  AddPackage(packagePath  as String )  as Boolean
CheckClientStatus

 

Test if the App-V 5 client is available

Function  CheckClientStatus()  as Boolean
DisableConnectionGroup

 

Disable the specified Connection Group for the current user.

Function  DisableConnectionGroup(groupID  as String , versionID  as String )  as Boolean
EnableConnectionGroup

 

Enable the specified Connection Group for the current user.

Function  EnableConnectionGroup(groupID  as String , versionID  as String )  as Boolean
GetApplicationPackageGUID

 

Retrieve the Package GUID for the given application name.

Function  GetApplicationPackageGUID(applicationName  as String )  as String
GetPackagePercentLoaded

 

Retrieve the percentage of data that is currently loaded for the package. If this returns 100, the package is available offline.

Function  GetPackagePercentLoaded(packageID  as String , versionID  as String )  as long
GetPackageSize

 

Get the size (in bytes) of the specified package.

Function  GetPackageSize(packageID  as String , versionID  as String )  as Variant
IsApplicationInstalled

 

Checks whether or not the specified application is installed.

Function  IsApplicationInstalled(applicationName  as String )  as Boolean
IsConnectionGroupCreated

 

Checks whether or not a Connection Group is already created for the specified identifiers.

Function  IsConnectionGroupCreated(groupID  as String , versionID  as String , Packages  as PackageBriefsCollection )  as Boolean
IsConnectionGroupEnabled

 

Checks whether or not the specified Connection Group is enabled for the current user.

Function  IsConnectionGroupEnabled(groupID  as String , versionID  as String )  as Boolean
IsPackageInstalled

 

Checks whether or not the specified Package is installed.

Function  IsPackageInstalled(packageID  as String , versionID  as String ,  Optional  useWMI  as Boolean = False )  as Boolean
IsPackagePublished

 

Checks whether or not the specified Package is published for the current user.

Function  IsPackagePublished(packageID  as String , versionID  as String )  as Boolean
MountPackage

 

Completely load all package data, making it available offline. Requires admin-rights

Function  MountPackage(packageID  as String , versionID  as String )  as Boolean
PublishPackage

 

Make an application available to the current user.

Function  PublishPackage(packageID  as String , versionID  as String )  as Boolean
Refresh

 

Refresh all collections

Sub  Refresh( Optional  ComputerName  as String  = “.”)
RemoveappvPublishingServer

 

Remove the App-V-5 publishing server from the client. Requires admin-rights

Function  RemoveAppvPublishingServer(serverName  as String )  as Boolean
Remove Connection Group

 

Remove the specified Connection Group from the client. Requires admin-rights

Function  RemoveConnectionGroup(groupID  as String , versionID  as String )  as Boolean
RemovePackage

 

Remove the specified application package from the client. Requires Admin-rights

Function  RemovePackage(packageID  as String , versionID  as String )  as Boolean
RepairConnectionGroup

 

Repair/reset the current user data for the specified Connection Group.

Function  RepairConnectionGroup(groupID  as String , versionID  as String )  as Boolean
RepairConnectionGroupOrPackage

 

Repair/reset the current user data for the specified Identifiers for Connection Group or Package.

Function  RepairConnectionGroupOrPackage(groupID  as String , versionID  as String )  as Boolean
RepairPackage

 

Repair/reset the current user data for the specified Package

Function  RepairPackage(packageID  as String , versionID  as String )  as Boolean
StartAppvVirtualProcess

 

Start a process inside the virtual environment of the specified Package or Connection Group.

Function  StartAppvVirtualProcess(packageID  as String , versionID  as String , executableFilePath  as String )  as Boolean
StopConnectionGroup

 

Shutdown the virtual environment for the specified Connection Group Requires admin-rights

Function  StopConnectionGroup(groupID  as String , versionID  as String )  as Boolean
StopPackage

 

Shutdown the virtual environment for the specified Package Requires admin-rights

Function  StopPackage(packageID  as String , versionID  as String )  as Boolean
SyncAppvPublishingServer

 

Synchronize the client with the specified publishing server.

Function  SyncAppvPublishingServer(serverName  as String )  as Boolean
UnpublishPackage

 

Make the specified application package unavailable to the current user.

Function  UnpublishPackage(packageID  as String , versionID  as String )  as Boolean

Applications

The Applications collection of the ScenseAppV5 object consists of one or more Application objects.

Properties Description
Count Number of Applications in the collection
Item

 

A specific Application item

 

Methods Description
GetApplication

 

Get the Application object for the specified name

Function  GetApplication(name  as String ) as  Application
GetApplicationById

 

Get the Application object for the specified GUID

Function  GetApplicationById(ApplicationGUID  as String ) as  Application
GetPackageApplications

 

Get a collection of Applications for the specified Package identifiers.

Function  GetPackageApplications(packageGUID  as String , versionGUID  as String ) as  Applications
Refresh

 

Refresh the collection

Function  Refresh()

Application

The Application objects are collected in the Applications collection of the ScenseAppV5 object.

Properties Description
ApplicationId Application GUID
EnabledForUser Is this application enabled for the current user
EnabledGlobally Is this application enabled for all users
PackageVersionId Version GUID of the package
TargetPath Path from where the package was loaded
Version Version of the application
Name Application name
PackageGUID Package GUID
Description Description for the application

Packages

The Packages collection of the ScenseAppV5 object consists of one or more Package objects.

Properties Description
Count Number of Packages in the collection
Item

 

Package object item

 

Methods Description
GetPackage

 

Retrieve a Package object for the specified name

 Function  GetPackage(name  as String ) as  Package
GetPackage_2

 

Retrieve a Package object for the specified identifiers.

Function  GetPackage_2(packageGUID  as String , versionGUID  as String ) as  Package
Refresh Refresh the collection

Package

The Package objects are collected in the Packages collection of the ScenseAppV5 object.

Properties Description
Applications Collection of Application objects associated with the package
InUse Is the package currently in use
IsPublishedGlobally Is the package published to all users
IsPublishedToUser Is the package published to the current user
PackageSize Size of the package in bytes
Path Path from which the package was loaded
PercentLoaded Percentage of the package that is already loaded
UserConfigurationData User configuration data
Version Package version
Name Package name
PackageGUID Package GUID
VersionGUID Package Version GUID
Description

 

Package description

 

Methods Description
Mount

 

Completely load the package for offline use.

Function  Mount()  as Boolean
Publish

 

Make the application package available for the current user.

Function  Publish()  as Boolean
Remove

 

Remove the package from the client. Requires admin-rights

Function  Remove()  as Boolean
Repair

 

Repair/reset the current user data for the application package.

Function  Repair()  as Boolean
Stop

 

Shutdown the virtual environment for the application package. Requires admin-rights

Function  Stop()  as Boolean
Unpublish

 

Make the application package unavailable for the current user.

Function  Unpublish()  as Boolean

ConnectionGroups

The ConnectionGroups collection of the ScenseAppV5 object consists of one or more ConnectionGroup objects.

Properties Description
Count The number of ConnectionGroup objects in the collection
Item

 

A ConnectionGroup object item

 

Methods Description
GetConnectionGroup

 

Retrieve a ConnectionGroup object for the specified name

Function  GetConnectionGroup(name  as String ) as  ConnectionGroup
GetConnectionGroupById

 

Retrieve a ConnectionGroup object for the specified identifiers

Function  GetConnectionGroupById(groupID  as String ) as  ConnectionGroup
Refresh Refresh the collection

Function  Refresh()

ConnectionGroup

The ConnectionGroup objects are collected in the ConnectionGroups collection of the ScenseAppV5 object.

Properties Description
InUse Is the ConnectionGroup in use
IsEnabledGlobally Is the ConnectionGroup enabled for all users
IsEnabledToUser Is the ConnectionGroup enabled for the current user
Packages Collection of Package objects included in the ConnectionGroup
PercentLoaded Percentage of the combined packages already loaded
GroupID ConnectionGroup GUID
Name Name of the ConnectionGroup
Priority Priority of this ConnectionGroup (in relation to other ConnectionGroups that also include one or more packages included in this ConnectionGroup)
VersionID Version GUID of this ConnectionGroup
Description

 

ConnectionGroup description

 

Methods Description
Disable

 

Disable the ConnectionGroup for this user

Function  Disable()  as Boolean
Enable

 

Enable the ConnectionGroup for this user

Function  Enable()  as Boolean
Repair

 

Repait/reset the current user data for the applications included in this ConnectionGroup

Function  Repair()  as Boolean

PackageBrief

The PackageBrief object is used for ConnectionGroup handling.

Properties Description
Name Name of the package
PackageGUID Package GUID
VersionGUID Version GUID
Description Package Description

Usage:

Sub Scense_Main()
   Dim objApps ' Applications
   Dim objPackages ' Packages
   Dim objPackage ' Package
   Dim objApp ' Application
   Dim objConGroup ' ConnectionGroup

       
    WriteScenseLog "---ClientStatus-------"	
    WriteScenseLog "CheckClientStatus returned:" & ScenseAppV5.CheckClientStatus()
       
    Call ScenseAppV5.Refresh

    ' all packages       
    Set objPackages = ScenseAppV5.Packages

    For Each objPackage In objPackages
       WriteScenseLog "PackageName: " & objPackage.Name & " Guid=" & _ 	objPackage.packageGUID 
       WriteScenseLog "Path:[" & objPackage.Path & "]"
    Next

    ' all connection groups    
    For Each objConGroup In ScenseAppV5.ConnectionGroups
       WriteScenseLog "GroupName: " & objConGroup.Name & " [GroupId=" & _ 	objConGroup.GroupId & " VersionId=" & objConGroup.VersionId & "]"
       WriteScenseLog "GroupName: " & objConGroup.Name & " [IsEnabledToUser=" & _ 	objConGroup.IsEnabledToUser & " IsEnabledGlobally=" & objConGroup.IsEnabledGlobally & "]"
       WriteScenseLog "GroupName: " & objConGroup.Name & " [Priority=" & _ 	objConGroup.Priority & " PercentLoaded=" & objConGroup.PercentLoaded & "]"
    Next

    Dim i		    	
    If objPackages.Count > 0 Then
     ' all package's applications
     For i=0 To ScenseAppV5.Packages.Count-1
      WriteScenseLog "-------"	
      WriteScenseLog "PackageName: " & ScenseAppV5.Packages(i).Name

      Set objApps = ScenseAppV5.Packages(i).Applications
       For Each objApp In objApps
          WriteScenseLog "ApplicationName: " & objApp.Name & " [Id=" & _ 	objApp.ApplicationId & "]"
       Next
       i=i+1
     Next
    End If

End Sub