Video Screencast Help
Search Video Help Close Back
to help
New in the Rewards Catalog: Vouchers for "Symantec Technical Specialist" and "Symantec Certified Specialist" exams.

How to Launch an Application or Run a Script when a Layer's State Changes

Updated: 29 Jul 2010 | 15 comments
Jeremy_Hurren's picture
+3 3 Votes
Login to vote

SVS CodeMaster Jeremy Hurren just threw another gem over the wall. If you want an SVS action (activate, deactivate, delete ...) to trigger an application, or send a message, or play a sound, here's the recipe.

Have you ever needed to run an external process when a layer gets activated, or deactivated, or deleted? You might, for example, have a third-party inventory system and want to re-evaluate the computer's inventory when layers activate and deactivate. (Send us your examples*).

Or maybe, like me, you just want to play a sound when layers activate. The following example plays the ding.wav file when a layer is activated and the chord.wav file when a layer is deactivated.

HKEY_LOCAL_MACHINE\SYSTEM\Altiris\FSL
OnPostActivate (MULTI_SZ) = "PlaySound.exe "C:\Windows\Media\ding.wav""
OnPostDeactivate (MULTI_SZ) = "PlaySound.exe "C:\Windows\Media\chord.wav""

In addition to a global setting like the one above, you can also change settings for individual layers by using the following registry key.

HKEY_LOCAL_MACHINE\SYSTEM\Altiris\FSL\1 (replace 1 with the layer number)

There are a number of events that can be captured in this fashion. Here is a complete list of the possible registry values, all of which are REG_MULTI_SZ types:

  • OnPreActivate
  • OnPostActivate
  • OnPreDeactivate
  • OnPostDeactivate
  • OnPreImport
  • OnPostImport
  • OnPreExport
  • OnPostExport
  • OnPreReset
  • OnPostReset
  • OnPreDelete
  • OnPostDelete
  • OnPreCreate
  • OnPostCreate
  • OnPreCapture
  • OnPostCapture

* Let us know if you've come up with some cool applications for this tip. Send us your ideas and we'll post them here.

Comments

hamletv's picture
05
May
2006
0 Votes 0
Login to vote

Activate/Deactivate related layer

Can it be made so that an application layer, when activated/deactivated, activates/deactivates a related data layer?

-Hamlet

Jeremy_Hurren's picture
09
May
2006
0 Votes 0
Login to vote

Activate/Deactivate related layer

Sure it can. You could just create an OnPostActivate and OnPostDeactivate for the application layer. For each, you would enter a command like "svscmd.exe [GUID-of-data-layer] activate" or "svscmd.exe [GUID-of-data-layer] deactivate".

Great Idea!

--LordJeb

---
Jeremy Hurren
Sr. Principal Software Engineer
Symantec Corp.

Thunder-man's picture
09
Nov
2006
1 Vote +1
Login to vote

Group Layer (OnPostActivate / OnPostDeactivate)

Hi,
I post a Tip for OnPostActivate / OnPostDeactivate to hide a file, when a Layer is activate / deactivate.

See this ...
Altiris support forum

Sorry for my bad English…

Google English…
SVSLoad.com

toralf's picture
16
Jan
2007
1 Vote +1
Login to vote

Hi lordjeb,

Hi lordjeb,

Thank you for adding this feature. It opens a lot of possibilities.

But I wonder how I could use OnPreCreate or OnPostCreate. A layer only exists after it is created. And I can't add anything to the registry when it doesn't exist yet.

Or are these events only useful as global events? I understood from your main post that the list of events only applies to layers. And that only the de-/activate events can also be used globally. But I guess I misinterpreted it. Could you please confirm? Thanks a lot.

Ciao
toralf

Ciao
toralf

sizemore's picture
02
Aug
2007
0 Votes 0
Login to vote

Services?

Could this be used to start a service? OR add a service and start it?

Altiris Newb

Swami's picture
25
Jan
2008
0 Votes 0
Login to vote

GUI Please

Is it possible to add / have a GUI Please?
You now for old guys like me, remembering the commands are bit tuff. I used to write it in a piece of paper & loose them frequently :(

Scott Jones's picture
25
Jan
2008
0 Votes 0
Login to vote

GUI = Wise Package Studio

The GUI for creating and editing SVS events is in Wise Package Studio. There is also a free tool here on the Juice.

Scott Jones
Product Manager
Altiris, Inc.
Now Part of Symantec

Scott Jones
Business Critical Engineer, Endpoint Virtualization
Symantec Corporation
www.symantec.com
 

Swami's picture
28
Jan
2008
1 Vote -1
Login to vote

Thank You

Thank You very much for the informations.
Regards,
Swami

rpfenninger's picture
06
Nov
2008
1 Vote +1
Login to vote

Restart spooler

We use the OnEvent actions (OnPostActivate, OnPostDeactivate and OnPostReset) most of the time to restart the spooler service so that printers from virtual packages work correctly.

Pascal.KOTTE at BECHTLE's picture
11
Mar
2009
0 Votes 0
Login to vote

The new link to the GUI tool is there !

https://www-secure.symantec.com/connect/downloads/...

Why not running a robot to correct this kind of failed link after migrating the Juice ? :-(

~Pascal @ Bechtle~ Do you speak French? Et utilisez Altiris: venez nous rejoindre sur le GUASF&l

clivant's picture
15
Jun
2011
0 Votes 0
Login to vote

Hi, I need to keep track of

Hi,

I need to keep track of whether my users are using the virtualized applications that I provisioned to them. Is it possible to detect the virtual applications that are launched by the users, programmatically? 

Nirmal R's picture
21
Jun
2011
0 Votes 0
Login to vote

Stand alone?

If you are using SWV stand alone, I've seen customer write their own tool to remotely monitor this. If you are using SWV in conjunction with CMS or Streaming, there are various reports you can run. If you need real time usage stats, consider using streaming.

Hope this helps.

clivant's picture
21
Jun
2011
0 Votes 0
Login to vote

Hi Nirmal, Thanks for

Hi Nirmal,

Thanks for replying. I am using SWV stand alone, any ideas how the customer wrote their own tool to monitor this? 

Nirmal R's picture
22
Jun
2011
0 Votes 0
Login to vote

WMI + svscmd

To my knowledge it was done with a combination of WMI (Windows Management Instrumentation) and svscmd

Pascal.KOTTE at BECHTLE's picture
26
Sep
2011
0 Votes 0
Login to vote

If want use "onevent" before a layer activated...

But you need to use a script, a package, or a tools, you need to include in your virtual package:

If the layer not activated, the content not "available", you can address the script with the "meta" variable

%VZ_LAYER_METADIR%

Provide the Meta folder inside the layer, all the same not yet activated:

see excellent Jordan article:

https://www-secure.symantec.com/connect/articles/getting-more-svss-onevent-functionality

I use this to create an Office installation, with the setup running on a empty layer, with all the Office source in the "meta" folder. So on post-import event: stop all layers, running the setup in "update mode" the empty layer, populate with the office installation, using the specific Windows context, to get a true "MSIEXEC" updating specific each current Windows machine, with previous Office existing data, and Windows context, different each machine...

~Pascal @ Bechtle~ Do you speak French? Et utilisez Altiris: venez nous rejoindre sur le GUASF&l