Please fix bug/lazy coding in DPM 2019 Powershell module

Copper Contributor

Hello.

From my standpoint the following is a bug, but technically it's just bad/lazy coding.

DPM 2019 Powershell module contains cmdlet called Copy-DPMDataSourceReplica which has a switch parameter called -CheckReplicaFragmentation.

If called directly from PSH, it outputs replica fragmentation info.

However it's not possible to capture this output in any manner (as to reuse it in a script etc.), because the implementation write the text to the console and not the pipeline.

The cmdlet is implemented in ObjectModelCmdlet.dll of DPM (located in DPM's \bin folder) and disassembler shows me this code:

 

private void InvokeCopyReplica()
    {
      if (this.Datasource.AssociatedReplica == null || !this.Datasource.AssociatedReplica.ReplicaExists)
        throw new DlsException(ErrorCode.InvalidOperation, "Reason", Messages.ShortTermTapeDatasource, new string[0]);
      if (this.CheckReplicaFragmentation.IsPresent)
        Console.Write("The fragmentation percentage for the {0} is {1}", (object) this.Datasource.Name, (object) this.Datasource.CopyDataSourceReplicaPath(this.CheckReplicaFragmentation.IsPresent));
      else
        this.Datasource.CopyDataSourceReplicaPath(this.CheckReplicaFragmentation.IsPresent);
    }

 

it's the Console.Write()

 

Are some MS employees watching these forums? Is there a way to report this bug since connect/uservoice and similar websites are terminated?

 

Does anyone know any workaround? From my searching it doesn't seem there's a way, at least not when the cmdlet is compiled in a .dll.

0 Replies