Skip to main content
1-Visitor
Mar 16, 2015 8:28 AM UTC
Solved

Batch command to check if user his currently logged into PTC

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

mrumpAnswer
16-Pearl
Mar 18, 2015 7:58 AM UTC

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

7 replies

16-Pearl
Mar 16, 2015 3:30 PM UTC

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 CS92347‌ CS119082, 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.

Translate
1-Visitor
Mar 16, 2015 3:51 PM UTC

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.

Translate
17-Peridot
Mar 16, 2015 4:02 PM UTC

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

Translate
mrump16-PearlAnswer
16-Pearl
Mar 18, 2015 7:58 AM UTC

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

Translate
16-Pearl
Mar 23, 2015 4:56 PM UTC

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

Translate