# Windows Package Notify If Installed

**URL:** <https://discourse.chef.io/t/windows-package-notify-if-installed/3724>\
**Category:** Chef Infra (archive)\
**Created:** [March 12, 2013, 9:59am UTC](https://discourse.chef.io/t/windows-package-notify-if-installed/3724 "2013-03-12T09:59:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_Gibbons](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@Daniel\_Gibbons](https://discourse.chef.io/u/Daniel_Gibbons)\
**Post date:** [March 12, 2013, 9:59am UTC](https://discourse.chef.io/t/windows-package-notify-if-installed/3724/1 "2013-03-12T09:59:36Z")

</div>

Hi,

I’m trying to create a recipe to install an application which needs additional configuration after installation so I’m trying to go down the Chef route of using “notifies” but I can’t seem to get it to work:

windows\_batch “test” do  
code \<\<-EOH  
echo DAN WAS HERE!!!  
EOH  
end

windows\_package “MarkLogic Server” do  
source node[‘markLogic’][‘installUrl’]  
action :install  
notifies :run, ‘windows\_batch[test]’, :delayed  
end

Even though the application doesn’t reinstall it always executes the “test”. I could just do all of this in PowerShell instead but it kind of defeats the object of using Chef.

Any suggestions/solutions appreciated as I can’t find anything in the docs to help.

Thanks

Dan

===================== DISCLAIMER ======================  
This message is intended only for the use of the person(s)  
(“Intended Recipient”) to whom it is addressed. It may contain  
information which is privileged and confidential. Accordingly  
any dissemination, distribution, copying or other use of this  
message or any of its content by any person other than the Intended  
Recipient may constitute a breach of civil or criminal law and is  
strictly prohibited. If you are not the Intended Recipient, please  
contact the sender as soon as possible.

Reed Business Information Limited.  
Registered Office: Quadrant House, The Quadrant, Sutton, Surrey, SM2 5AS, UK.  
Registered in England under Company No. 151537

=======================================================

---

<div class="post-metadata">

**Author:** ![Mike](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/mike/32/18_2.png) [@Mike](https://discourse.chef.io/u/Mike)\
**Post date:** [March 12, 2013, 12:11pm UTC](https://discourse.chef.io/t/windows-package-notify-if-installed/3724/2 "2013-03-12T12:11:00Z")

</div>

Dan,

You may have to add an 'action' to your statement, to prevent it from  
executing each run.

Something like:

windows\_batch "test" do  
code \<\<-EOH  
echo DAN WAS HERE!!!  
EOH  
action :nothing  
end

Hope this helps,  
-M

On Tue, Mar 12, 2013 at 5:59 AM, Gibbons, Daniel (RBI-UK)  
[Daniel.Gibbons@rbi.co.uk](mailto:Daniel.Gibbons@rbi.co.uk) wrote:

> Hi,
> 
> I’m trying to create a recipe to install an application which needs  
> additional configuration after installation so I’m trying to go down the  
> Chef route of using “notifies” but I can’t seem to get it to work:
> 
> windows\_batch "test" do
> 
> code \<\<-EOH
> 
> ```
> echo DAN WAS HERE!!!
> 
> ```
> 
> EOH
> 
> end
> 
> windows\_package "MarkLogic Server" do
> 
> source node['markLogic']['installUrl']
> 
> action :install
> 
> notifies :run, 'windows\_batch[test]', :delayed
> 
> end
> 
> Even though the application doesn’t reinstall it always executes the “test”.  
> I could just do all of this in PowerShell instead but it kind of defeats the  
> object of using Chef.
> 
> Any suggestions/solutions appreciated as I can’t find anything in the docs  
> to help.
> 
> Thanks
> 
> Dan
> 
> ===================== DISCLAIMER ======================  
> This message is intended only for the use of the person(s)  
> ("Intended Recipient") to whom it is addressed. It may contain  
> information which is privileged and confidential. Accordingly  
> any dissemination, distribution, copying or other use of this  
> message or any of its content by any person other than the Intended  
> Recipient may constitute a breach of civil or criminal law and is  
> strictly prohibited. If you are not the Intended Recipient, please  
> contact the sender as soon as possible.
> 
> Reed Business Information Limited.  
> Registered Office: Quadrant House, The Quadrant, Sutton, Surrey, SM2 5AS,  
> UK.  
> Registered in England under Company No. 151537
> 
> =======================================================
