# GatewayHook determine module is being uninstall

**URL:** <https://forum.inductiveautomation.com/t/gatewayhook-determine-module-is-being-uninstall/41998>\
**Category:** Module Development\
**Tags:** ignition80\
**Created:** [January 6, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/gatewayhook-determine-module-is-being-uninstall/41998 "2021-01-06T15:00:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpervaiz](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mpervaiz](https://forum.inductiveautomation.com/u/mpervaiz)\
**Post date:** [January 6, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/gatewayhook-determine-module-is-being-uninstall/41998/1 "2021-01-06T15:00:41Z")

</div>

During module setup I am creating some data in c:\ProgramData\[Some\_folder\_name]. During uninstall I want to remove all that data, however I can’t determine the function that I can use for it in GatewayHook.

Is there a function that can be overriden ?

---

<div class="post-metadata">

**Author:** ![PerryAJ](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/perryaj/32/3281_2.png) [@PerryAJ](https://forum.inductiveautomation.com/u/PerryAJ)\
**Post date:** [January 6, 2021, 5:23pm UTC](https://forum.inductiveautomation.com/t/gatewayhook-determine-module-is-being-uninstall/41998/2 "2021-01-06T17:23:16Z")

</div>

Take a look at [GatewayModuleHook](http://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/gateway/model/GatewayModuleHook.html), which is implemented by AbstractGatewayModuleHook. There is a `shutdown` method that is called when the module is being shut down, as occurs when the gateway shuts down, or the module shuts down prior to uninstall/restart.

---

<div class="post-metadata">

**Author:** ![mpervaiz](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@mpervaiz](https://forum.inductiveautomation.com/u/mpervaiz)\
**Post date:** [January 6, 2021, 7:09pm UTC](https://forum.inductiveautomation.com/t/gatewayhook-determine-module-is-being-uninstall/41998/3 "2021-01-06T19:09:34Z")

</div>

Shutdown is great, but I want to be able to differentiate between uninstall and restart. I dont want to clean up if it is restart only when the module is uninstalled.

---

<div class="post-metadata">

**Author:** ![KathyApplebaum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kathyapplebaum/32/7261_2.png) [@KathyApplebaum](https://forum.inductiveautomation.com/u/KathyApplebaum)\
**Post date:** [January 6, 2021, 11:42pm UTC](https://forum.inductiveautomation.com/t/gatewayhook-determine-module-is-being-uninstall/41998/4 "2021-01-06T23:42:28Z")

</div>

The module itself won’t have any way to know whether it’s being shutdown for restart or for uninstall.
