Due to COVID and all, we've got people all over the world returning to the office. However a lot of them haven't been in in over 60 days, causing the DC to block the laptops. Normally we unjoin the domain, reboot and rejoin. However this is not feasible to do physically with 200+ computers scattered around the world.
Due to the above I've been looking into doing it through CMD. I got most of it working, but when giving the wmic computersystem where name!=null call unjoindomainorworkgroup
command on the machine (through a psexec remotely) I get the below feedback:
C:\WINDOWS\system32>wmic computersystem where name!=null call unjoindomainorworkgroup
.Executing (\\COMPUTERNAME\ROOT\CIMV2:Win32_ComputerSystem.Name="COMPUTERNAME")->unjoindomainorworkgroup()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
ReturnValue = 5;
};
However when I reboot and call the list of domains, it still shows the domain as joined:
C:\WINDOWS\system32>wmic computersystem get domain
Domain
DOMAIN.local
Any clues where I'm going wrong or pointers to do this more efficiently?