none
DPM 2010 Shell Cmdlets usage leading to Powershell crash RRS feed

  • Question

  • Hi all,

    I have 71 DPM 2010 servers located at various places in the world. The most of them have a good and reliable network connection while some of them are connected via Sat-Link. All of my DPM 2010 servers have the same version, and are all running in identical W2K8 Servers with Powershell 3 installed on them. I've made a script to inventorize Datasource Replica disk usage/allocation, shadow volume disk usage/allocation and the number of recovery points, their size. The goal of this script is to do the job that DPM 2010 should normaly do, for instance, deleting recovery points above retention date because it is not always the case... File recovery points number grows to their maximum (64) and for system State (because there is no User recovery on these ressources) their number can be above 100 and generally it's about 150...

    The script is running well locally, but if I try yo run a single Get-Datasource from one of my servers targeting another server, sometimes it leads to a simple Powershell crash... I also tried an invoke-command as job it's the same, the job returns nothing but it is marked as completed or sometimes as failed. This happens always on some server and on the other only sometimes...

    I really don't understand where is the origin of this problem... As anyone encountered such behaviour ?

    Thanks a lot in advance ;-)


    Saturday, February 22, 2014 11:40 AM

Answers

  • Solution found...

    The computer name must be in Uppercase AND must be in the FQDN format... like XXXBACKUP001.contoso.com

    If you run the command Get-Datasource localy with XXXBACKUP001 it works but accross an Invoke-Command, it doesn't... Pretty weird... Lost hours on this

    • Marked as answer by Philip Tomson Wednesday, February 26, 2014 9:57 AM
    Wednesday, February 26, 2014 9:57 AM

All replies

  • I did not find a solution to my problem yet, but I solved a part of it...

    The first of all "Powershell crash" was solved by issuing a Disconnect-DPMServer before each Get-DataSource...

    The second problem solved was the fact that the Get-DataSource cmdlet required the parameter <DPMServer> to be fully in Uppercase...

    The last problem remaining is the Invoke-command that continue to fail... Here is my code :

    $DPMServerStatusList = @()
    foreach($DPMServer in $DPMServerList){
        
        if(Test-Connection -Count 1 -BufferSize 16 -ComputerName $DPMServer){
            $DPMServerStatusList += @{
                Reachable = $True
                Computer = $DPMServer
            }
        }else{
            $DPMServerStatusList += @{
                Reachable = $False
                Computer = $DPMServer
            }
        }
    }
    
    $i=1
    foreach ($DPMServerState in $DPMServerStatusList){
        Write-Host $i ")" $DPMServerState.Computer " : " -BackgroundColor Blue -ForegroundColor White -NoNewline
        if($DPMServerState.Reachable){
            Write-Host "ONLINE" -BackgroundColor Green
            $Computer = $DPMServerState.Computer
            
            Invoke-Command -ComputerName $Computer -AsJob -JobName "$Computer" -ScriptBlock {
                param(
                    $Computer
                )
            
                if((Get-PSSnapin -Name "Microsoft.DataProtectionManager.PowerShell" -ErrorAction SilentlyContinue) -eq $null ){
                    Add-PSSnapin -Name "Microsoft.DataProtectionManager.PowerShell"
                }
    
                Disconnect-DPMServer
                $DPMDataSources = Get-Datasource -DPMServerName $Computer
                $DPMTotalConsumedSpace = 0
                $DPMTotalUnshrinkableSpace = 0
                $DPMTotalRealSpaceUsage = 0
                $DPMTotalWastedSpace = 0
    
                $DPMDataSourceReport = @()
                foreach($DPMDataSource in $DPMDataSources){
                
                    if($DPMDataSource.ReplicaSize -ge 0){
    
                        $DPMTotalConsumedSpace += $DPMDataSource.ReplicaSize
                        $DPMTotalConsumedSpace += $DPMDataSource.ShadowCopyAreaSize
    
                        $DPMTotalUnshrinkableSpace += $DPMDataSource.ReplicaSize
    
                        $DPMTotalRealSpaceUsage += $DPMDataSource.ReplicaUsedSpace
                        $DPMTotalRealSpaceUsage += $DPMDataSource.ShadowCopyUsedSpace
    
                        $DPMDataSourceName = $DPMDataSource.DatasourceName
                        $DPMProtectionGroupName = $DPMDataSource.ProtectionGroupName
                        $DPMReplicaSpaceStatus = "" + $(($DPMDataSource.ReplicaSize) / 1GB) + "GB / " + $(($DPMDataSource.ReplicaUsedSpace) / 1GB) + "GB"
                        $DPMShadowSpaceStatus = "" + $(($DPMDataSource.ShadowCopyAreaSize) / 1GB) + "GB / " + $(($DPMDataSource.ShadowCopyUsedSpace) / 1GB) + "GB"
                        $DPMOldestDate = $DPMDatasource.GetRecoveryPoint()[0].RepresentedPointInTime
                        $DPMRecoveryPointNumber = $DPMDatasource.GetRecoveryPoint().Count
                        $DPMRecoveryPointNumberToBeCleaned = $($DPMRecoveryPointNumber - 35)
    
                        #Write-Host ""
                        #Write-Host "     Name : " $DPMDataSourceName
                        #Write-Host "     ProtectionGroup : " $DPMProtectionGroupName
                        #Write-Host "     Replica Space Status : " $DPMReplicaSpaceStatus 
                        #write-Host "     Shadow Copy Status : " $DPMShadowSpaceStatus
                        #Write-Host "     Earliest Date : " $DPMOldestDate
                        #Write-Host "     RecoveryPointsNumber : " $DPMRecoveryPointNumber
    
    
                        if($DPMRecoveryPointNumberToBeCleaned -gt 0){
    
                            $DPMDeleteFrom = $DPMDatasource.GetRecoveryPoint()[0].RepresentedPointInTime
                            $DPMDeleteTo = $DPMDatasource.GetRecoveryPoint()[$DPMRecoveryPointNumberToBeCleaned].RepresentedPointInTime
                            $DPMRestorePointsListToDelete = $(0..$DPMRecoveryPointNumberToBeCleaned) | %{$_}
    
                            #Write-Host "     RecoveryPointsToBeCleaned : " $DPMRecoveryPointNumberToBeCleaned -BackgroundColor Red
                            #Write-host "     Will delete Restore point from : " $DPMDeleteFrom " to " $DPMDeleteTo
                            #Write-host "     Restore Point ID To delete : " $DPMRestorePointsListToDelete
    
                            $DPMDataSourceReport += @{
                                Name = $DPMDataSourceName
                                ProtectionGroup = $DPMProtectionGroupName
                                ReplicaSpaceStatus = $DPMReplicaSpaceStatus
                                ShadowSpaceStatus = $DPMShadowSpaceStatus
                                OldestDate = $DPMOldestDate
                                RecoveryPointNumber = $DPMRecoveryPointNumber
                                RecoveryPointNumberToBeCleaned = $DPMRecoveryPointNumberToBeCleaned
                                DeleteFrom = $DPMDeleteFrom
                                DeleteTo = $DPMDeleteTo
                                RestorePointsListToDelete = $DPMRestorePointsListToDelete
                            }             
    
    
                        }else{
                            #Write-Host "     RecoveryPointsToBeCleaned : None" -BackgroundColor Green
                            $DPMDataSourceReport += @{
                                Name = $DPMDataSourceName
                                ProtectionGroup = $DPMProtectionGroupName
                                ReplicaSpaceStatus = $DPMReplicaSpaceStatus
                                ShadowSpaceStatus = $DPMShadowSpaceStatus
                                OldestDate = $DPMOldestDate
                                RecoveryPointNumber = $DPMRecoveryPointNumber
                                RecoveryPointNumberToBeCleaned = 0
                                DeleteFrom = 0
                                DeleteTo = 0
                                RestorePointsListToDelete = @()
                            }             
                        }
                        #Write-Host "     Realocate Data Require : " $DPMDatasource.ReAllocationRequired                                  
                    }
                }
    
                $DPMTotalWastedSpace = $DPMTotalConsumedSpace - $DPMTotalRealSpaceUsage
                #Write-Host "_______________________________________________________"
                #Write-Host "Global Status : "
                #Write-Host "     Disk Allocation : " $($DPMTotalConsumedSpace / 1GB) "GB"
                #Write-Host "     Disk Usage : " $($DPMTotalRealSpaceUsage / 1GB) "GB"
                #Write-Host "     Locked Space : " $($DPMTotalUnshrinkableSpace / 1GB) "GB"
                #Write-Host "     Wasted Space : " $($DPMTotalWastedSpace / 1GB) "GB"
    
                return $DPMFinalReportArray = @{
                    ServerName = $Computer
                    DiskAllocation = $DPMTotalConsumedSpace
                    DiskUsage = $DPMTotalRealSpaceUsage
                    LockedSpace = $DPMTotalUnshrinkableSpace
                    WastedSpace = $DPMTotalWastedSpace
                    DataSources = $DPMDataSourceReport
                }
    
            } -ArgumentList $Computer
    
        }else{
            Write-Host ": OFFLINE" -BackgroundColor Red
        }
        
        $i++
    }

    If it can help... What do am I doing wrong ?


    • Edited by Philip Tomson Tuesday, February 25, 2014 8:47 AM Error in code
    Monday, February 24, 2014 12:29 PM
  • Here is a small piece of code involving a single DPM cmdlet which obviously doesn't work ;-)

    Invoke-Command -ComputerName "XXXBACKUP001" -AsJob -JobName "DebbugJob" -ScriptBlock { Add-PSSnapin -Name "Microsoft.DataProtectionManager.PowerShell" $DPMDataSources = Get-Datasource -DPMServerName "XXXBACKUP001" $ReplicaSizes = @() foreach($DPMDataSource in $DPMDataSources){ $ReplicaSizes += $DPMDataSource.ReplicaSize } return $ReplicaSizes }

    If I run the scriptblock above locally or within a remote session there is no problem, everything works well !

    But within the Invoke-Command its broken... if I do a Receive-Job, I get no return value, only this error message :

    Processing data from remote server XXXBACKUP001 failed with the following error message: The WSMan provider host process did not return a proper response.  A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic.

        + CategoryInfo          : OperationStopped: (XXBACKUP001:String) [], PSRemotingTransportException

        + FullyQualifiedErrorId : JobFailure

        + PSComputerName        : XXXBACKUP001

    I can run any Invoke-Command but not a DPM Shell Cmdlet and I don't know why...



    Wednesday, February 26, 2014 6:54 AM
  • Solution found...

    The computer name must be in Uppercase AND must be in the FQDN format... like XXXBACKUP001.contoso.com

    If you run the command Get-Datasource localy with XXXBACKUP001 it works but accross an Invoke-Command, it doesn't... Pretty weird... Lost hours on this

    • Marked as answer by Philip Tomson Wednesday, February 26, 2014 9:57 AM
    Wednesday, February 26, 2014 9:57 AM