Hi Eric, I am by no means a programmer but I have done some work with
powershell. I would while loop thru the servers and use something like
transcribe (powershell command) to capture and log the output of the dsmc
command to a temp file on disk after each dsmc attempt and then use
select-string (
https://www.thomasmaurer.ch/2011/03/powershell-search-for-string-or-grep-for-powershell/)
to search for the string you want to check on, and start the correct
function based on the outcome. I'm 100% sure it can be done without these
writes and reads but for these kinds of things I figure it won't make that
much of a difference.

Regards,
  Stefan

On Tue, Jul 27, 2021 at 4:41 PM Loon, Eric van (ITOP NS) - KLM <
eric-van.l...@klm.com> wrote:

> Hi everybody,
>
> We recently switched to a new server design based on node replication. My
> Windows users always used scripts which went through all TSM/SP servers to
> find the right one by just trying to connect to them, one by one. As soon
> as the dsmc q sess command returned return code 0, it found the right
> server. This always worked, until we switched to node replication. Now all
> of a sudden, there are two servers which return rc=0, but only one of them
> can be used for backups, the primary replication server.
> I have been struggling to find a way how to determine which server is the
> primary and which is the replica server. I noted that if you connect to the
> correct server, the last line of the query session output is "Configured
> for failover to server <SERVERNAME>". If you connect to the replica, the
> last line is "Not configured for failover".
> Now I need to find a way (preferably though PowerShell) to read this last
> line and generate a rc=0 if it contains "Configured for failover to server"
> and a higher return code if it contains "Not configured for failover". Has
> anybody with Windows scripting knowledge has any idea how to do this?
> Thanks for any help in advance!
>
> Kind regards,
> Eric van Loon
> Air France/KLM Storage & Backup
> ********************************************************
> For information, services and offers, please visit our web site:
> http://www.klm.com. This e-mail and any attachment may contain
> confidential and privileged material intended for the addressee only. If
> you are not the addressee, you are notified that no part of the e-mail or
> any attachment may be disclosed, copied or distributed, and that any other
> action related to this e-mail or attachment is strictly prohibited, and may
> be unlawful. If you have received this e-mail by error, please notify the
> sender immediately by return e-mail, and delete this message.
>
> Koninklijke Luchtvaart Maatschappij NV (KLM), its subsidiaries and/or its
> employees shall not be liable for the incorrect or incomplete transmission
> of this e-mail or any attachments, nor responsible for any delay in receipt.
> Koninklijke Luchtvaart Maatschappij N.V. (also known as KLM Royal Dutch
> Airlines) is registered in Amstelveen, The Netherlands, with registered
> number 33014286
> ********************************************************
>

Reply via email to