hchabria
asked on
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.
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.
ASKER
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.
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.
from the powershell prompt, do the invoke-item line and see what happens. Does PS return a warning or error?
ASKER
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"
}
#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"
}
Not what I meant. do the invoke-item line by itself from a powershell prompt.
ASKER
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.
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.
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.
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.
ASKER
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?
Isn't it possible to trap any errors that is arising while launching the ica file in a LAN environment?
Only if the ICA client returns an error that can be caught. Looks like it does not do that.
ASKER
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?
Is there any other way to do the same using PS?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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"
}