Tuesday, April 15, 2014

DPM–An unexpected error occurred while the job was running (ID 104)

Scenario

DPM tape taken from a Production site and imported into DPM in DR site.  Everything is successful and can view the content.  (Link on how to import external DPM tape is located here.)

The settings were follow :

  • Firewall has been allowed for DPM to communicate between the DPM server and the DR Test Restore server.
  • Antivirus has been made exclusions

Test results as follow :

  • Restore to DPM (DR site) local hard disk is successful
  • Restore from DPM (DR Site) to another server which is connected directly network cable in same segment of the backup vLAN is also successful
  • Restore from DPM (DR Site) to the DR Test Restore server failed.

The error showed in DPM is as follow when doing the restore :

SCR2

The event viewer in the DPM showed as follow :

“Most or all jobs failed to recover the requested data (ID : 3111).  An unexpected error occurred while the job was running (ID : 104)”

image

After looking for sometime in Technet and blogs, there’s no solution. 

Then realised that the segment for the new DR Test Restore server is sitting in another segment.  It’s in another segment (172.31.110.33).  The entry had already been entered in the Host File (C:\Windows\System32\drivers\etc), however it’s still not working.

Then at last, found the issue was on the Backup vLAN configurations (Link to “How to force to use alternate Path for Backup (Backup VLAN) is located here).  So I edited to add in the 172 segment

image

After the entry was entered then I restarted the DPMRA services by elevated command prompt.

  • net stop dpmra
  • net start dpmra

After that I perform the restore from DPM in DR site to the DR Test Restore server, it was successful.

keywords  : An unexpected error occurred while the job was running ID : 104 , Most or all jobs failed to recover the requested data (ID : 3111) DPM restore, DPM backup failed restore.

Monday, April 7, 2014

How to check Disk Space Usage and Free Space Remotely using PowerShell

Scenario :

Two hyper-V Host (clustered) with multiple VMs in it.  I need to check on the disk allocation, disk space usage & disk free space.  With the script below I’m going to share how I did it using PowerShell.  I just run it in one of the Hyper-V Hosts PowerShell.

[Special credit to StackOverflow and BinaryNature.  I’ve made changes to ease the entry of variables]

The credential used in the script must be part of the local administrators group

# ----- Beginning of Script -----

#Define ServerName (Physical/VM) Here

# Change the Variables in PINK and remark out with # if the server or VM is not needed

$PHY1="SVR1"
$PHY2="SVR2"
$AD1="ADVM1"
$APP1="APPVM1"
# $APP2="APPVM2"
$DB1="DBVM1"
$DP1="DPVM1"
$DPM1="DPMVM1"
$DomainUser = "domain\user1"

# Diskfree Module

function Get-DiskFree
{
    [CmdletBinding()]
    param
    (
        [Parameter(Position=0,
                   ValueFromPipeline=$true,
                   ValueFromPipelineByPropertyName=$true)]
        [Alias('hostname')]
        [Alias('cn')]
        [string[]]$ComputerName = $env:COMPUTERNAME,
     
        [Parameter(Position=1,
                   Mandatory=$false)]
        [Alias('runas')]
        [System.Management.Automation.Credential()]$Credential =
        [System.Management.Automation.PSCredential]::Empty,
     
        [Parameter(Position=2)]
        [switch]$Format
    )
 
    BEGIN
    {
        function Format-HumanReadable
        {
            param ($size)
            switch ($size)
            {
                {$_ -ge 1PB}{"{0:#.#'P'}" -f ($size / 1PB); break}
                {$_ -ge 1TB}{"{0:#.#'T'}" -f ($size / 1TB); break}
                {$_ -ge 1GB}{"{0:#.#'G'}" -f ($size / 1GB); break}
                {$_ -ge 1MB}{"{0:#.#'M'}" -f ($size / 1MB); break}
                {$_ -ge 1KB}{"{0:#'K'}" -f ($size / 1KB); break}
                default {"{0}" -f ($size) + "B"}
            }
        }
     
        $wmiq = 'SELECT * FROM Win32_LogicalDisk WHERE Size != Null AND DriveType >= 2'
    }
 
    PROCESS
    {
        foreach ($computer in $ComputerName)
        {
            try
            {
                if ($computer -eq $env:COMPUTERNAME)
                {
                    $disks = Get-WmiObject -Query $wmiq `
                             -ComputerName $computer -ErrorAction Stop
                }
                else
                {
                    $disks = Get-WmiObject -Query $wmiq `
                             -ComputerName $computer -Credential $Credential `
                             -ErrorAction Stop
                }
             
                if ($Format)
                {
                    # Create array for $disk objects and then populate
                    $diskarray = @()
                    $disks | ForEach-Object { $diskarray += $_ }
                 
                    $diskarray | Select-Object @{n='Name';e={$_.SystemName}},
                        @{n='Vol';e={$_.DeviceID}},
                        @{n='Size';e={Format-HumanReadable $_.Size}},
                        @{n='Used';e={Format-HumanReadable `
                        (($_.Size)-($_.FreeSpace))}},
                        @{n='Avail';e={Format-HumanReadable $_.FreeSpace}},
                        @{n='Use%';e={[int](((($_.Size)-($_.FreeSpace))`
                        /($_.Size) * 100))}},
                        @{n='FS';e={$_.FileSystem}},
                        @{n='Type';e={$_.Description}}
                }
                else
                {
                    foreach ($disk in $disks)
                    {
                        $diskprops = @{'Volume'=$disk.DeviceID;
                                   'Size'=$disk.Size;
                                   'Used'=($disk.Size - $disk.FreeSpace);
                                   'Available'=$disk.FreeSpace;
                                   'FileSystem'=$disk.FileSystem;
                                   'Type'=$disk.Description
                                   'Computer'=$disk.SystemName;}
                 
                        # Create custom PS object and apply type
                        $diskobj = New-Object -TypeName PSObject `
                                   -Property $diskprops
                        $diskobj.PSObject.TypeNames.Insert(0,'BinaryNature.DiskFree')
                 
                        Write-Output $diskobj
                    }
                }
            }
            catch
            {
                # Check for common DCOM errors and display "friendly" output
                switch ($_)
                {
                    { $_.Exception.ErrorCode -eq 0x800706ba } `
                        { $err = 'Unavailable (Host Offline or Firewall)';
                            break; }
                    { $_.CategoryInfo.Reason -eq 'UnauthorizedAccessException' } `
                        { $err = 'Access denied (Check User Permissions)';
                            break; }
                    default { $err = $_.Exception.Message }
                }
                Write-Warning "$computer - $err"
            }
        }
    }
 
    END {}
}


$cred = Get-Credential -Credential $DomainUser
$PHY1, PHY2, $AD, $APP1, $APP2, $DB1, $DP1, $DPM1 | Get-DiskFree -Credential $cred -Format | Format-Table -GroupBy Name -AutoSize


# ----- End of Script -----

Steps

My method was copy the script above (from Beginning to End of the Script)  into a notepad and make changes only to the PINK.  Please include the “ “ quotes as in the scripts. 

(You can also save it as powershell script with ext of PS1 and run. Since this is a one time, I don’t intend to save it as PS1 file)

After making the necessary changes, I copied the text and launch the PowerShell (need to run as Administrator) from one of the Hosts

image

…then I paste into the PowerShell screen and press [Enter]

image

It will display the credential, key in the password :

image

It will display something like below with the (servername or VM name as I’ve hide) :

image

Happy trying  and hope the script helps as it helps me.

keywords : checking free space with powershell, powershell scripts, power shell script, checking space usage remotely, windows 2012 check disk space in VM

Thursday, April 3, 2014

Enabling Data Deduplication in my Windows 8.1

Recently my storage usage space in my drive is getting more and more and I’ve got to find a way to reduce it.  I read a few blogs and found a solution which is the dedup (I know that I have duplicate files in my drive but need sometime to housekeep Smile with tongue out )

This method is not officially supported by Microsoft however found a way to save my disk space.

This method requires the CAB files from the Windows Server 2012 R2.  Either you can get those files from a Windows Server 2012 R2 or you can download the files from my OneDrive here.

The files are as follow :

  • Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab
  • Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab
  • Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab
  • Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab
  • Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab
  • Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab

I downloaded the files to a folder as below :

image

Then in the command prompt I execute the following command (I executed in the particular folder where the files reside) :

dism /online /add-package /packagepath:Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab /packagepath:Microsoft-Windows-VdsInterop-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab  /packagepath:Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab /packagepath:Microsoft-Windows-FileServer-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab  /packagepath:Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~~6.3.9600.16384.cab /packagepath:Microsoft-Windows-Dedup-Package~31bf3856ad364e35~amd64~en-US~6.3.9600.16384.cab

It looks something like below  :

image

Next I enable the Dedup Feature by executing the following command prompt:

dism /online /enable-feature /featurename:Dedup-Core /all

It looks something like below :

image

Verify your add/remove features in your Windows (launch the Programs and Features)

image

Next is launch the PowerShell (elevated mode)

Example below is I’m targeting on my D Drive (only change the one in yellow colour in the command for your target drive)

Enable-DedupVolume -Volume D:

Set-DedupVolume -Volume D: -OptimizeInUseFiles

It looks like :

image

To force the Dedup to start immediately, simply run the following command in Powershell

Start-DedupJob -Volume D: -Type Optimization

image

After waiting for a while, to monitor execute the command in powershell :

Get-DedupVolume -Volume D: | fl

It will display as below :

image

Special credit to Wei King and also Mailspintoys for their sharing.

Thank you

keywords : deduplicate, dedup, windows 8.1 dedup, reduce storage space, reduce disk space