Easy way to fix “The trust relationship between this workstation and the primary domain failed”

This happens very often. Usually I was rejoining workstation/server to the domain. However it is easier way to do it.

  1. You have to log in to the server with a broken relationship.
  2. You have to know the name of Domain Controller (example: AD01)
$DomainCred = Get-Credential
Reset-ComputerMachinePassword -Server "AD01" -Credential $DomainCred

That’s all.

How to kill frozen service

Hi Guys,

This happens very often that you are going to services.msc and you want to restart service and after a few seconds, you see that service is hung (grey out).

Step1. Grab the name of the service.

Step2. Get PID of the service.
sc queryex servername

looking for PID

Step3. Kill the PID
taskkill /f /pid [PID]

That’s all, now you can start service in service console.

How to find SID users/groups/computers star from pa*

I had to get SID for all Users that Logon Name begin with pa

Get-ADUser -Filter {Name -like "pa*"} | Select Name,SID | Format-Table -Auto

For all Groups that Name begin with pa

Get-ADGroup -Filter {Name -like "pa*"} | Select Name,SID | Format-Table -Auto

For all Computers that Name begin with pa

Get-ADComputer -Filter {Name -like "pa*"} | Select Name,SID | Format-Table -Auto

Getting VHD size plus info using PowerShell for the all Virtual Machines on the cluster

Hi Guys,

This is was not a simple task… because of Get-VMHardDiskDrive can’t give you the size of the drive.

$VMget=Get-VM -ComputerName (Get-ClusterNode -Cluster ClusterName) | Get-VMHardDiskDrive | Select-Object -Property vmname, vmid, computername, controllertype, controllernumber,controllerlocation,path
foreach ($VM in $VMget) {
$VHDRemotePath=$VM.Path -replace ":", "$"
$VHDRemotePath="\\"+$VM.ComputerName+"\"+$VHDRemotePath
$vhdsize= Get-ChildItem $VHDRemotePath | select-object @{Name="SizeGB";Expression={"{0:N2}" -f ($_.length / 1GB)}}
$text = $VM.VMName + " , " + $vhdsize.SizeGB + "GB , " + $VM.Path
$text | out-file C:\Temp\VHD_Size.csv -Append
}

It exports to CSV however you still have to use “Text to Columns” in Excel.

Enjoy 🙂

How to fix broken group policy object or Direct Access

Hi Guys,

Some of my users are able to break Direct Access and when they run gpupdate /force they are getting

“The processing of Group Policy failed. Windows could not apply the registry-based policy settings for the Group Policy object LocalGPO. Group Policy settings will not be resolved until this event is resolved. View the event details for more information on the file name and path that caused the failure.”

To fix it:
Go to the: C:\Windows\System32\GroupPolicy (This folder is hidden)
Go to the machine folder: rename registry.pol to registry.bak
Run gpupdate /force
Restart computer.

That’s all.

Sysvol folder doesn’t exist in Windows 2012/16 after deploying DC in AD 2008.

Hi guys,

After deployed Windows 2012/16 and promoting it to AD SYSVOL folder is not sync with Windows 2008. Problem this exists because Windows 2008 in default is using FSRM when Windows 2012/16 DFSR to sync SYSVOL.

Fix: migrating FRS to DFSR SYSVOL.
1. If you deployed Windows 2012 and have this problem please uninstall AD role from new server.

2. Go to your old AD server and raised domain level to at least Windows Sever 2008.

Set-ADDomainMode -Identity domain.name.com -DomainMode Windows2008Domain

FSRM to DFSR Migration
3. Migrate to Prepared State
Type: Dfsrmig /setglobalstate 1

Type: Dfsrmig /getmigrationstate

When all DCs are ready, the output will look like this:

4.Migrate to Redirected State
Type: Dfsrmig /setglobalstate 2

Type: Dfsrmig /getmigrationstate

When all DCs are ready, the output will look like this:

5.Migrate to Eliminated State
Type: Dfsrmig /setglobalstate 3

Type: Dfsrmig /getmigrationstate

When all DCs are ready, the output will look like this:

Your migration is complete.

5. Please install AD role on the new sever.

6. Check SYSVOL folder on the new server.

That’s all!

How to migration DHCP from Windows Server 2008 to 2012

Today simple tip how to migrate DHCP from Windows Server 2008 to 2012.

  • Log on to the old/existing DHCP server.
  • Click Start, click Run, type cmd in the Open box, right-click, and then “Run as Administrator”.
  • Type netsh dhcp server export C:\Users\Desktop\dhcp.txt all , and then press ENTER.
  • Install the DHCP role on the new (2012) DHCP server using Server Manager.
  • Copy the exported DHCP text file to the desktop of the new DHCP server.
  • Verify that the DHCP service is installed and started on the new DHCP server.
  • Click Start, click Run, type cmd in the Open box, right-click, and then “Run as Administrator”.
  • Type netsh dhcp server import C:\Users\Desktop\dhcp.txt all , and then press ENTER
  • Open DHCP console on the new server.
  • In the console tree, right-click DHCP.
  • Select “Authorize”.

That’s all folks.

How to uninstall Windows Server Essentials Experience

Hi,
Simple tip.

1. Cancel the Initial Configuration Wizard on the physical host
2. RUN -> Regedit
3. Remove the registry key telling the Wizard to auto-load:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Delete the entry named: EssentialsRoleConfigWizard

4. Open Server Manager and remove ALL roles/features, EXCEPT those specified below:
* ROLES left installed: Storage Services
* FEATURES left installed: .NET Framework 4.5(no ASP or WCF), SMB 1.0/CIFS, Graphical Management Tools, Server Graphical Shell, PowerShell 4.0, WoW64 Support
5. After removing roles/features and rebooting, you can go ahead and install the Hyper-V role then create your VM

Enjoy.