'*********************************************************************** ' ' ' svrOnline.vbs ' ' Description: Bring a Citrix Presentation Server "online" by re-publishing applications ' published from the server. The published app names are stored ' to a text file that is the output of the svrOffline script. ' ' Usage: One optional command line parameters - 1) Citrix server name (case ' sensitive ' ' e.g. >cscript svrOnline.vbs MFXPTS05 ' '*********************************************************************** ' Get server name from command line or input box Set objArgs = WScript.Arguments If objArgs.Count > 1 Then srvName = objArgs(0) Else srvName = InputBox("Enter the servername: ") End If ' Initialize MetaframeFarm Set Farm=CreateObject("MetaframeCOM.MetaframeFarm") Farm.Initialize 1 ' Open text file Set fso = CreateObject("Scripting.FileSystemObject") Set fp = fso.OpenTextFile(srvname & ".txt", 1, vbFalse) ' Loop through servers in the farm, then each app on that server For Each mfserver in Farm.servers If mfserver.servername = ucase(srvname) Then ' Loop through the text file to get the application names to add While Not fp.AtEndOfStream Set mfApp = CreateObject("MetaFrameCOM.MetaFrameApplication") appName = fp.ReadLine mfApp.Initialize 3, appName mfApp.LoadData True WScript.sleep 500 mfApp.AddServer mfserver.AppBinding(appName) mfApp.SaveData Set mfAppBinding = Nothing Set mfApp = Nothing Wend End If Next fp.Close set fp = Nothing ' Delete the file fso.DeleteFile(srvname & ".txt") set fso = Nothing set mfSvr = Nothing set Farm = Nothing MsgBox "Citrix Server "& srvname &" Back Online"