Skip to main content
1-Visitor
March 16, 2015
Solved

Batch command to check if user his currently logged into PTC

  • March 16, 2015
  • 3 replies
  • 4638 views

In my application I need to check if the user is logged into the PTC

I can check the process (si.exe) and conclude that PTC is running. But I cannot verify if the user has logged into PTC.

Is there any batch file to check if user is currently logged into PTC.

Thanks

Best answer by mrump

The simplest approach to check whether the current user already has a running connection Integrity is the "si servers" command.

It lists all running connections to all servers and for all users currently established on this client, like this

<user>@<server>:<port>

If there is no connection it returns an empty string.

so for a batch file:

1. run "si servers" (it also starts the client it necessary)

2. search the resulting output for the correct triple: user, server and port

If it cannot be found, use "si connect" to connect your user to the server. (the "--gui" would enforce an interactive login).

If you you find it, you know the is a runnign connection you can use.

3. go ahead with your batch code

HTH Matthias

3 replies

16-Pearl
March 16, 2015

Hello Mohd,

Do you mean a CLI command that the user can use to see if a local user connection exists?

Take a look at CS92347CS119082, which covers some useful commands for these types of situations.

Regards,

Kael

--------

Edited by Kael 2015-03-17EST11:27: Put in the case solution reference I had intended, crossed out and de-linked the complete wrong case solution reference.

1-Visitor
March 16, 2015

Kael,

I could not view this. I got the following error:

Error: Document 92347 is not customer viewable as it is an internal PTC document.

17-Peridot
March 16, 2015

I get the same error when trying to open the link provided.

mrump16-PearlAnswer
16-Pearl
March 18, 2015

The simplest approach to check whether the current user already has a running connection Integrity is the "si servers" command.

It lists all running connections to all servers and for all users currently established on this client, like this

<user>@<server>:<port>

If there is no connection it returns an empty string.

so for a batch file:

1. run "si servers" (it also starts the client it necessary)

2. search the resulting output for the correct triple: user, server and port

If it cannot be found, use "si connect" to connect your user to the server. (the "--gui" would enforce an interactive login).

If you you find it, you know the is a runnign connection you can use.

3. go ahead with your batch code

HTH Matthias

16-Pearl
March 23, 2015

Hello Mohd,

Did any of the posts in this thread provide you with the information you needed? If so, could you mark the post as correct by clicking on the Correct Answer button at the bottom of the post which resolved your issue? You can also mark posts as helpful by going to the bottom of a post and choosing Actions -> Mark as Helpful. These actions let contributors know that you have resolved your issue, and lets everybody know (including future visitors) what actually helped you resolve your issue.

If the issue is still not resolved for you, could you let us know what problems you are still experiencing?

Regards,
Kael