Service -desktop Communication - powershell

I have WCF Service hosted on windows. The WCF service actually invokes a Powershell script which in turn has commands to run a third party EXE. This powershell script also communicates with the exe by setting it to focus and sending key strokes. My problem is everything goes according to plan except that script is unable to send key strokes as windows service runs in different session (session 0) , hence my service is unable to communicate to the desktop (user's current session). Can anybody help me in making a communication between service and desktop.

Related

How to get over my Valid Application from being repeatedly Blocked by Firewall

I use Delphi. I have a backup application which has to run constantly on my customers machines. Communicaton is done via TCP/IP Sockets & data is transferred via FTP.
My problem is that sometimes when the customer upgrades his AntiVirus or I send a upgrade the Firewall blocks my Application even though setup was done via elevated rights. How do I overcome this. I had thought running my communication portion from a Windows Service Application would solve the matter.

Understanding PowerShell cmdlet for adding a trusted UCMA 4.0 application and a trusted UCMA 4.0 application endpoint

I am trying to create a UCMA 4.0 application for Lync 2010. In the development phase the application will be hosted in my laptop and the lync server (on which I have no jurisdiction) will connect to my laptop and run the application. The OS in my laptop is Windows 7 SP 1 and the .Net framework is 4.5.
I am fairly new to UCMA coding and though I have studied about it, there are still some grey areas that needs to be addressed. Below are some of the questions that I have failed to get a clear answer of. Also, it is more important for me to understand the nitty gritties because the Lync server admin is a new person on the job who has, like me, never worked on UCMA applications.
I need to create an application pool. For that, the PowerShell cmdlet to be used is
New-CsTrustedApplicationPool -Identity foo.example.com -Registrar [Registrar Id] -Site [Site id] –ComputerFqdn foo.example.com
I assume this cmdlet must be run on the lync server. Since my laptop will be the only computer in the application pool in the development phase so my -ComputerFQDN and -Identity of the application pool are the same. Is this correct? Also, where will I get the Registrar ID and the Site ID? What is the difference between a manually provisioned application and an auto provisioned application?
To add a trusted application:
New-CSTrustedApplication –ApplicationId $ApplicationId -TrustedApplicationPoolFqdn $ApplicationFqdn -Port $PortNo
What exactly is application id. Is it my computer FQDN/application_name? I have assumed that the TrustedApplicationPoolFqdn is the same as my computer FQDN since there is only a single computer in the application pool. Also, will any available port no. do or should it be the one listening to my application? Since, I have not completed coding my application, getting the exact port no. is not possible. They want to setup the server before the coding is done. That is the challenge.
To create the trusted application endpoint:
New-CSTrustedApplicationEndpoint –ApplicationId $ApplicationId -TrustedApplicationPoolFqdn $ApplicationFqdn -SipAddress $ApplicationSipAddress –DisplayName
What is -SipAddress here? Where and how will I get the SIP address?
I know I have crammed a lot of questions here. But I am running low on knowledge and available resources and I am in a desperate need of some direction, given the time constraints that I am facing. Apart from the questions if anybody can help me with any heads up, you are more than welcome and appreciated to do so. All I need right now is some perspective from the stackoverflow community.
I assume this cmdlet must be run on the lync server. Since my laptop will be the only computer in the application pool in the development phase so my -ComputerFQDN and -Identity of the application pool are the same.
Is this correct?
No. It can be run from any computer that has the Lync / SfB powershell commands installed and you have enough "rights" to run the powershell commands. I run these sorts of commands from my dev machine all the time.
I normally develop with UCMA v4 (not 5) and when you install ocscore.msi from the SDK/runtime install or copy it from the Lync 2013 install. You can get the SfB powershell to install but I've found it be more of a pain than the Lync 2013 version and mostly you don't need SfB version (i.e. the Lync 2013 powershell commands work fine on a SfB server install).
Also, where will I get the Registrar ID and the Site ID?
The Registrar ID is the front end pool (the sip proxy to register with). You can get it with the powershell command:
Get-CsService -Registrar
Look at the "Identity" field and should look like:
Registrar:name.lyncdomain e.g. Registrar:myserver.company.com
You can get the Site ID from the Get-CsSite command. It should look like: Site:ID e.g. Site:MY_SITE
What is the difference between a manually provisioned application and an auto provisioned application?
This is a very big difference.
A manually provisioned application requires more code to setup and run your UCMA trusted application. You have to know all the settings and all the trusted application endpoints yourself.
A auto provisioned application requires less code to setup and run. All you need is a id and with that id you can query the UCMA API to pull all that trusted application setup and all the trusted application endpoints. This sounds great but the downside of a auto provisioned application setup means that all the computers in the application pool has to be setup as a replication point for the Lync database. To setup the computer as a replication point is a BIG pain in the pass (it takes about 1/2 hour to setup if you know what you are doing).
I suggest setting your application pool / application as a manually provisioned application as it's actually a lot simpler to setup in the long run unless you require the ability to automatically "know" what trusted application endpoints are setup to your application.
What exactly is application id.
Anything you like. It just needs to be unique (kind of) within the Lync environment. You can use Get-CsTrustedApplication command to see what other
application id's are already in use. It basically is the unique ID for your application.
Is it my computer FQDN/application_name?
It is the FQDN (fully qualified domain name) of the application pool. If should match the application pool ComputerFqdn value. It's basically telling Lync what application pool that this trusted application runs on. Trusted applications can only run on a application pool computer only.
is the same as my computer FQDN since there is only a single computer in the application pool.
In a single computer application pool, yes. In a multi-computer application pool, no. It is the ComputerFqdn of the pool.
Also, will any available port no. do or should it be the one listening to my application?
The port number has to be a available port on the pool computer. It is used by the UCMA application to listen on and is used by the Lync server (FE) to connect to the UCMA application as per the SIP RFC.
For auto provisioned application, the UCMA application will auto-load this value and use it. For manual provisioned application, you can either hard code it or load it from your own config setup (e.g. from registry?). I would recommend that you load from your own config somewhere like the registry.
What is -SipAddress here? Where and how will I get the SIP address?
It's whatever you want it to be. It needs to be a unique SIP address within the whole Lync setup. It should be in the format of sip:name#lyncdomain e.g. sip:myendpoint#company.com
It will be the primary entry point for SIP messages into your application if your application even uses / wants a sip endpoint to:
make audio calls, receive audio calls, provide presence, send/receive IM messages, etc.
If you aren't going to use a trusted application endpoint (e.g. you only want to impersonate user endpoints) then you don't need any trusted application endpoints.

Using Remote Method Invocation to interact with windows service? Better alternatives?

I am currently using Remote Method Invocation to interact with a windows service. As services cannot be interactive (UI) strictly from Vista and above, I cannot directly call those methods. So I am using Remote Method Invocation to access those methods. How safe is RMI?
Are there any better alternatives to using RMI? Like File channeling/ sockets and Listeners.
edit: Let me make it clear,
I have a java application which runs as a windows service. But I would like to manipulate the service and the way it works from an user interface but When I try to do that, Windows wont allow me to do that. So I am using RMI to manipulate the windows service from an user interface.(interactively).
Keep in mind that there is a reason for windows services not being able to have an UI. If you need an UI to interact with the service, what's the reason for running the program to interact with as a service anyway?
That being said, I'm using RMI to interact with the service (simply to do some configuration, poll status information; the program being executed as a service usually runs without any user interaction) - it's worked out pretty well so far.
You could of course use simple sockets (however, RMI is also built on sockets). A simple Listener won't work since you'll need some inter process communication.

Powershell: Is it possible to have a service depend on remote services

I'm using Win32 Service object and there's Change which could be used to set Dependencies. Is it possible to set the service to depend on services running on a different machine? Currently, all the services run on the same machine but it's possible to run them each on a separate machine.
Nothing like that exists today, AFAIK. It is a good ask. Check this MS connect item: http://connect.microsoft.com/WindowsServerFeedback/feedback/details/293384/remote-machine-service-dependency
That said, you can create a script or another service to poll remote machines for dependent service startup and then start the local service.

Client times out when launching XenApp6 app from internet

Using XenApp6 on Windows 2008 R2 I have the windows Calculator as a test app. Apps are set to run on the server, and are not streamed to the client. When running Calculator from inside the network it runs as expected.
However, when accessing the app from an external web browser or Citrix Receiver, the client always times out and the Calculator app is not launched. I see incoming traffic on port 1494 (which is open) but there is no response from XenApp.
For both internal and external, I log in as Administrator and can see the citrix management console showing my test Calculator app.
Any ideas why it's timing out and not launching from the internet?
Thanks.
Chris
If the Citrix server's internal IP is being NATted to an external IP you may need to set an alternate address using altaddr on the Citrix server. Try this: Download the ICA file that the Citrix server passes when you launch a published app from a web browser, open it in a text editor, and see what FQDN or IP it is trying to connect to.