none
Execute commands on a remote DPM server with powershell RRS feed

  • Question

  •  I am trying to execute dpm commands via the invoke command method, but I still have an error.
    I would like your help, please.
    Thank you very much!

    begin

        {  
            [System.Management.Automation.PSCredential]$_session = Get-Credential
        }

        process
        {
            
            Invoke-Command -ComputerName my_dpm_server -Credential $_session  -ScriptBlock { Get-DPMDatasource}
        }

    Message error:

    [my_dpm_server] the connection to the remote server my_dpm_server failed with the following error message: the client can not connect to the destination specified in the request.


    • Edited by ODIACI Thursday, October 24, 2019 12:24 PM
    Thursday, October 24, 2019 12:22 PM

Answers

  • Just checking to see if you have any update?

    You may also ask the experts in the dedicated Windows PowerShell forums:

    Windows Server > Windows PowerShell


    Blog: https://thesystemcenterblog.com LinkedIn:

    • Proposed as answer by Leon Laude Monday, December 2, 2019 8:03 AM
    • Marked as answer by ODIACI Thursday, December 5, 2019 9:18 AM
    Monday, December 2, 2019 8:03 AM
  • Yes you can make use of the Get-DPMJob PowerShell cmdlet to retrieve information about backup jobs.

    Below are a few examples:

    Retrieve the recent jobs for a protection group

    $PGroup = Get-DPMProtectionGroup -DPMServerName "DPMServer01.domain.com"
    Get-DPMJob -ProtectionGroup $PGroup

    Retrieve the successful jobs for a specific protected server

    Get-DPMJob -DPMServerName "DPMServer.domain.com" -ProductionServerName "DC01.domain.com" -Status 3

    DPM job status codes:

    • 1 = In Progress
    • 2 = Failed / Warning
    • 3 = Succeeded

    Blog: https://thesystemcenterblog.com LinkedIn:

    • Marked as answer by ODIACI Wednesday, December 11, 2019 9:43 AM
    Thursday, December 5, 2019 11:01 AM

All replies

  • Hi,

    The script looks OK, make sure that you have set the execution policy to RemoteSigned so that you are allowed to run remote commands, you will also need to enable PS Remoting.

    Set-ExecutionPolicy RemoteSigned
    Enable-PSRemoting


    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Thursday, October 24, 2019 12:30 PM
  • Hi,

    Thank you for your answer

    I type these commands on the remote computer?

    46/5000
    I type these commands on the remote machine?
    Thursday, October 24, 2019 12:50 PM
  • On the source computer from where you initiate the PowerShell script.


    Blog: https://thesystemcenterblog.com LinkedIn:

    Thursday, October 24, 2019 12:53 PM
  • I typed these commands on the source computer, but I have the same error :the connection to the remote server my_dpm_server failed with the following error message: the client can not connect to the destination specified in the request.
    Thursday, October 24, 2019 1:00 PM
  • How are you running this script and with what user privileges?

    - Ensure that the Windows Remote Management (WS-Management) service is started.

    - Run a command prompt as Administrator and enter the following command and confirm whether the IPv4Filter or IPv6Filter is configured to block the IP of the machine running the XIA Configuration Client.

    winrm get winrm/config


    Try running the script as administrator if you haven't.


    Blog: https://thesystemcenterblog.com LinkedIn:

    Thursday, October 24, 2019 1:04 PM
  • When I am running : winrm get winrm/config, I have IPV4filter = * IPV6filter = *

    I work with administrator priveleges.

    Thursday, October 24, 2019 2:06 PM
  • Make sure there is no firewall blocking the ports, you can also refer to this:

    How to Run PowerShell Commands on Remote Computers


    Blog: https://thesystemcenterblog.com LinkedIn:

    Thursday, October 24, 2019 2:09 PM
  • thank you very much.

    I will look at this link soon.

    Have a nice evening

    Thursday, October 24, 2019 2:44 PM
  • Hi,

    Just checking in to see if you have any update?


    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, October 28, 2019 12:55 PM
  • Hi,

    I have not looked yet, for lack of time.
    In any case, I thank you

    Tuesday, October 29, 2019 3:48 PM
  • You're welcome, keep us updated!

    Blog: https://thesystemcenterblog.com LinkedIn:

    Tuesday, October 29, 2019 4:18 PM
  • Hi,

    I can use the command invoke-command, to connect to other servers, without problem.

    it's when I try remote access on a DPM server that it does not work.

    I think that, the problem is the DPM server. I am a beginner in windows administration and powershell also.

    Monday, November 25, 2019 3:04 PM
  • What are the errors?

    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, November 25, 2019 3:08 PM
  • [Myserver-dpm1] The connection to the remote server Myserver-dpm1 failed with the following error message: The client can not connect to the destination specified in the request. Check that the service is in running on the destination and that he accepts requests. Check the Web Services Management service logs and documentation running on the destination, most often IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to parse and configure the WinRM service: "winrm quickconfig".

    For more information, see
    help topic about_Remote_Troubleshooting.

    + CategoryInfo          : OpenError: (Myserver-dpm1:String) [], PSRemotingTransportException
    + FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken

    Monday, November 25, 2019 4:06 PM
  • The error states that you don't have PowerShell Remoting enabled, you can enable it with the command below:

    Enable-PSRemoting -Force

    You can then also try the following:

    Enter-PSSession -ComputerName "DPMSERVER.domain.com" -Credential DPMAdmin

    Get-DPMDatasource


    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, November 25, 2019 4:51 PM
  • Hi,

    Thank you!

    I had errors, here they are:

    PS C:\Windows\system32> begin
        {  
            Enable-PSRemoting -Force
            [System.Management.Automation.PSCredential]$_session = Get-Credential xxxx\administrateur 
        }

        process
        {
            Enter-PSSession -ComputerName "xxxx-dpm6.xxxx.fr" -Credential $_session
            get-dpmdatasource
        }
    get-dpmdatasource : The term "get-dpmdatasource" is not recognized as a cmdlet name, function, script file, or executable program. Check the spelling of the name, or if a path
    exists, check that the path is correct and try again.
              Ligne:10 : 9
    +         get-dpmdatasource
    +         ~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ObjectNotFound: (get-dpmdatasource:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
     

    [xxxx-dpm6.xxxx.fr]: PS C:\Users\administrateur.xxxx\Documents> 

    ///////////////////////////////////////////////////////////////////another method

    PS C:\Windows\system32> begin
        {  
            Enable-PSRemoting -Force
            [System.Management.Automation.PSCredential]$_session = Get-Credential xxxx\administrateur 
        }

        process
        {
           Invoke-Command -ComputerName xxxx-dpm6 -Credential $_session  -ScriptBlock { get-dpmdatasource}
        }
    Warning : Connecting to the DPM server : xxxx-DPM6.xxxx.fr
    Can not connect to xxxx-dpm6.xxxx.fr. (ID : 948)
    Verify that the DPM service is running on this computer.
        + CategoryInfo          : NotSpecified: (:) [Get-DPMDatasource], DlsException
        + FullyQualifiedErrorId : ConnectionToServerFailed,Microsoft.Internal.EnterpriseStorage.Dls.UI.Cmdlet.Common.GetDatasource
        + PSComputerName        : xxxx-dpm6

    PS C:\Windows\system32> 

    Friday, November 29, 2019 1:08 PM
  • The first script won't work, because it will try connecting to the local server.

    The second script works for me without problems, so it's not a scripting issue.

    Something is still blocking the connection, a firewall perhaps?

    Make sure you have the firewall open from the server you are running the script on, to the DPM server and the server hosting the DPM database.



    Blog: https://thesystemcenterblog.com LinkedIn:

    • Proposed as answer by Leon Laude Monday, December 2, 2019 8:03 AM
    Friday, November 29, 2019 1:42 PM
  • Just checking to see if you have any update?

    You may also ask the experts in the dedicated Windows PowerShell forums:

    Windows Server > Windows PowerShell


    Blog: https://thesystemcenterblog.com LinkedIn:

    • Proposed as answer by Leon Laude Monday, December 2, 2019 8:03 AM
    • Marked as answer by ODIACI Thursday, December 5, 2019 9:18 AM
    Monday, December 2, 2019 8:03 AM
  • Thank you for your help and your answers.

    I will put the problem in the forum you told me.

    Thursday, December 5, 2019 8:48 AM
  • You're welcome.

    (Please don't forget to mark helpful replies as answer, this helps the community to identify helpful replies)


    Blog: https://thesystemcenterblog.com LinkedIn:

    Thursday, December 5, 2019 8:51 AM
  • ok, no problem.

    or else, I want to query my dpm server, so that it returns the status of the backup of a given computer.

    do you want to tell me how, can I do?
    Thank you in advance.
    Thursday, December 5, 2019 9:19 AM
  • Yes you can make use of the Get-DPMJob PowerShell cmdlet to retrieve information about backup jobs.

    Below are a few examples:

    Retrieve the recent jobs for a protection group

    $PGroup = Get-DPMProtectionGroup -DPMServerName "DPMServer01.domain.com"
    Get-DPMJob -ProtectionGroup $PGroup

    Retrieve the successful jobs for a specific protected server

    Get-DPMJob -DPMServerName "DPMServer.domain.com" -ProductionServerName "DC01.domain.com" -Status 3

    DPM job status codes:

    • 1 = In Progress
    • 2 = Failed / Warning
    • 3 = Succeeded

    Blog: https://thesystemcenterblog.com LinkedIn:

    • Marked as answer by ODIACI Wednesday, December 11, 2019 9:43 AM
    Thursday, December 5, 2019 11:01 AM
  • I thank you.

    I will look at his solution later, and I will come back to you.

    Monday, December 9, 2019 9:29 AM