Repairing the Domain Trust Relationship

If a computer is restored from an old restore point or a snapshot that was created before the computer’s password was changed in AD, the machine password in the snapshot will differ from the AD computer object password.

When the trust relationship between a workstation and the Active Directory domain is broken, you will encounter errors such as:

The trust relationship between this workstation and the primary domain failed.

or

The security database on the server does not have a computer account for this workstation trust relationship.

To restore trust between the machine and the domain, you must log on to the computer locally using an account with local administrator privileges. Open your elevated terminal session and check if you have a valid trust relationship with the AD Domain with following PowerShell command:

Test-ComputerSecureChannel -Verbose

Should the result be something like

VERBOSE: The secure channel between the local computer and the domain <DOMAIN> is broken.

You can fix it by running the repair command:

Test-ComputerSecureChannel -Repair -Credential <DOMAIN>\<ADMINUSER> -Verbose

Result should be like this:

VERBOSE: The secure channel between the local computer and the domain <DOMAIN> was successfully repaired.

No reboot or delete/add to AD is needed.

How to delete Windows Recovery Partition

Latest Windows versions place the recovery partition after the main partition which prevents disk resizing in guest installations. Her how to delete the partition:

Open PowerShell in Administrative Mode and execute:

diskpart
list volume
select volume <number of volume>
delete volume override

Migrate Windows File Server

Microsoft File Server migration in my case consisted of 3 steps:

  1. Copy files (including NTFS permissions)
  2. Copy shares
  3. Copy quotas

Here is what to do:

Copy files using robocopy

i copied files from my old to new server using following command on the source server:

robocopy.exe .\MyRootFolder \\MyDestinationServer\driveletter$\MyRootFolder /MIR /SEC /SECFIX /W:3 /R:3 /E /ZB /COPYALL /V

To learn more about the parameters, go to this microsoft page for robocopy

Copy shares

Use regedit to export / import following key and its content:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanServer\Shares

Copy quotas

Now this was the most complicated part as it involved some scripting. First export the quota templates from the source server:

dirquota.exe template export /file:C:\quota.xml

copy that file onto the destination server and do:

dirquota.exe quota template import /file:<path_to_xml_file>

Afterwards you have to output the specific quotas and add them with:

dirquota.exe quota add /Limit:<size_in_gb_or_mb> /SourceTemplate:<name_of_the_template> /Path:<path_to_quota_folder>

Source: https://suddhaman.blogspot.com/2020/07/file-server-migration-windows-server.html