Citrix: Script to allow you to disable published applications using the task scheduler!

 

 

 

 

Today i was curious if it was possible to disable applications in Citrix at a specified time. A little bit of Googling later and i found this script:

Save this as vbs file. This script will disable an app after prompting for the
appname.
I included subroutines for both enabling and disabling
app
depending on what you want, comment out the lines where the
subroutine is
called.
‘=========================================================================
‘This
script is tested successfully in XPE FR3 farm using mfcom
‘SDK
version 2.3
‘Legal Disclamier
‘Test this script in your test
environment before using in production
‘Use at your own risk, me
or the company i work for is not responsible For
‘any issues this
script might cause in your
environment
‘=========================================================================
set
farm=createobject(“metaframecom.metaframefarm”)
farm.initialize
1
Const MetaframeWinAppObject=3
Const
AppEnabled=1
Const
AppDisabled=0

appinput=inputbox(“Enter
the Application Name to be enabled:”)

‘For schedule Task,
comment above line and uncomment following line, by hard-coding
appname
‘appinput=“exceed” ‘If exceed needs to be
disabled

for each app in farm.applications
if
ucase(app.appname)=ucase(appinput)
then
Wscript.echo “App
Found”
appDN=app.distinguishedname
‘Call
EnableApp() ‘Enable App
Call DisableApp() ‘Disable
App
end if
next

Sub EnableApp()
set
app1=createobject(“Metaframecom.metaframeapplication”)
app1.Initialize
MetaframeWinAppObject,appDN
app1.loaddata(true)
app1.EnableApp=AppEnabled
app1.savedata()
WScript.Echo
“Application: “&Ucase(appinput)&”
Is enabled”
End Sub

Sub DisableApp()
set
app1=createobject(“Metaframecom.metaframeapplication”)
app1.Initialize
MetaframeWinAppObject,appDN
app1.loaddata(true)
app1.EnableApp=AppDisabled
app1.savedata()
WScript.Echo
“Application: “&Ucase(appinput)&”
Is disabled”
End Sub

set farm=Nothing
set
app1=Nothing

wscript.echo “DONE”

here is the original link for the curious: http://forums.citrix.com/thread.jspa?messageID=208886&fromSearchPage=true&

 

This is great so if you know you have a maintenance window that you want certain apps offline, you can schedule this so users cannot log in to them via citrix.

 

Fun stuff