How to Perform the Backup/Restore SPFarm Operations using PowerShell

BackUp

Syntax
  1. Backup-SPFarm -BackupMethod <String> -Directory <String> [-AssignmentCollection <SPAssignmentCollection>] 
    [-BackupThreads <Int32>] [-ConfigurationOnly <SwitchParameter>] [-Confirm [<SwitchParameter>]] 
    [-Force <SwitchParameter>] [-Item <String>] [-Percentage <Int32>] [-WhatIf [<SwitchParameter>]]   
Example
  1. Backup-SPFarm -Directory \\file_server\share\Backup -BackupMethod full -ConfigurationOnly     
Restore

Syntax 
  1. Restore-SPFarm -Directory <String> -RestoreMethod <String> [-AssignmentCollection <SPAssignmentCollection>] 
    [-BackupId <Guid>] [-ConfigurationOnly <SwitchParameter>] [-Confirm [<SwitchParameter>]] 
    [-FarmCredentials <PSCredential>] [-Force <SwitchParameter>] [-Item <String>] [-NewDatabaseServer <String>] 
    [-Percentage <Int32>] [-RestoreThreads <Int32>] [-WhatIf [<SwitchParameter>]]    
     
Example
  1. Restore-SPFarm -Directory \\file_server\share\Backup -BackupId 12345678-90ab-cdef-1234-567890abcdef -RestoreMethod new -ConfigurationOnly