One-Liner: Is my Laptop Connected to a Domain Controller?

I'm a remote worker - my work colleagues think I'm rather distant!

Actually, what I meant was that I work from remote locations. A lot.

My laptop is domain-joined. I quite often want to update my Group Policy settings to get 'stuff' working. From a session running as Administrator, here's what I do:

while (-not (Test-ComputerSecureChannel)) {Start-Sleep -Seconds 10}; Invoke-GPUpdate -RandomDelayInMinutes 0 -Force

 

I need to have established a secure channel with a domain controller for the Group Policy update to work. As a remote worker, this can take a while following logon. Appropriately, I use a while loop to test whether the secure channel is established.

PS - Direct Access rocks. Seriously. It is to remote access what Hendrix was to a guitar.