PowerShell Script for XenApp

I have created an .ica file called Notepad.ica. On double-clicking it launches the Notepad published from a particular server.

I am also using the following code to execute that Notepad.ica file.

Invoke-Item D:\Notepad.ica

I need a PowerShell code that will write a log if it unable to launch the Notepad.ica file using PowerShell. Can you please help me on that?

I am using XenApp 5 version.
hchabriaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl WebsterCommented:
For testing do this:

invoke-item d:\notepad.ica -ea 0
if( !$? )
{
      $Tmp2 = Get-Date
      $Tmp1 = "OOPS got an error on "
      write-output "$Tmp1 $Tmp2"
      add-content d:\oops.txt "$Tmp1 $Tmp2"
}
0
hchabriaAuthor Commented:
CardWebstar

I disabled the network on a XenApp server from which the Notepad.ica has been published.

I then executed the script you have given. The Notepad is not launching with an error as expected, but the problem is that I am not getting any output in the D:\oops.txt file.

Please help me.
0
Carl WebsterCommented:
from the powershell prompt, do the invoke-item line and see what happens.  Does PS return a warning or error?
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

hchabriaAuthor Commented:
I've commented out the invoke-item line, but no result. PS is not giving any warning or error.

#invoke-item d:\notepad.ica -ea 0
if( !$? )
{
      $Tmp2 = Get-Date
      $Tmp1 = "OOPS got an error on "
      write-output "$Tmp1 $Tmp2"
      add-content d:\oops.txt "$Tmp1 $Tmp2"
}
0
Carl WebsterCommented:
Not what I meant.  do the invoke-item line by itself from a powershell prompt.
0
hchabriaAuthor Commented:
Sorry for the confusion.

I executed invoke-item from a powershell prompt. The Notepad application is launching properly.

I then put the XenApp server out of network. Now t's giving the following error:

"Cannot connect to the Citrix Presentation Server. The Citrix Presentation Servers are reporting full load and cannot accept your connection at this time. Try to connect again after a few minutes. If you continue to receive this message, contact your Citrix administrator."

Please let me know what else I have to do.
0
Carl WebsterCommented:
Looks like it is returning an error that PowerShell cannot handle.
Are the users launching Notepad.ica on your LAN or external?  If external, can you mail me a copy of the ICA file and I will test it here.  Change the file extension to .txt.
0
hchabriaAuthor Commented:
We are in a LAN environment. Citrix applications cannot be accessed from external.

Isn't it possible to trap any errors that is arising while launching the ica file in a LAN environment?
0
Carl WebsterCommented:
Only if the ICA client returns an error that can be caught.  Looks like it does not do that.
0
hchabriaAuthor Commented:
Okay. My primary intention is to create a PowerShell script that will launch each application automatically and then report if any fail.

Is there any other way to do the same using PS?
0
Carl WebsterCommented:
I do not see a Citrix supplied PowerShell cmdlet for launching appllications.

These are all I see dealing with applications:

·         Copy-XAApplication                                                                                                    
·         Disable-XAApplication                                                                                                  
·         Enable-XAApplication                                                                                                  
·         Get-XAApplication                                                                                                      
·         Move-XAApplication                                                                                                    
·         New-XAApplication                                                                                                      
·         Remove-XAApplication                                                                                                  
·         Rename-XAApplication                                                                                                  
·         Set-XAApplication                                                                                                      
·         Add-XAApplicationAccount                                                                                              
·         Remove-XAApplicationAccount                                                                                            
·         Add-XAApplicationFileType                                                                                              
·         Remove-XAApplicationFileType                                                                                          
·         Get-XAApplicationIconStream
·         Get-XAApplicationReport
·         Add-XAApplicationServer                                                                                                
·         Remove-XAApplicationServer
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hchabriaAuthor Commented:
Not what I wanted to get as a solution. However, if there is no solution for that then I am Okay with that. Thanks for your effort.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Citrix

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.