PDQ.com mobilePDQ.com desktop
Support

Managing Domain Memberships with PowerShell

Stephen Valdinger
·

Let’s go through some steps that may prove helpful in speeding up your processes in joining machines to a domain, or helping you to migrate machines to a new domain at scale. We will utilize some pretty simple PowerShell to accomplish this task. So without further ado, grab a drink, sit back, and let’s do this!

Checking Domain Membership

We need some logic to see if the machine is currently a member of a domain. That’s pretty simple with PowerShell. The code looks like this (and will return a true/false value):

(Get-WMIObject win32_computersystem).partofdomain

Removing a Machine from a Domain

This also is going to return to us a true/false value. Given that we want to put the machine on a new domain, let’s use some logic to automate removing the machine from its current domain membership.

If ( (Get-WMIObject win32_computersystem).partofdomain 

Don't miss the next post!

401k and Powershell

How To Track 401k Growth With PowerShell - Part 2

Part 2 of how to track 401k growth with PowerShell, with additional code to tack on to our 401k calculator

PowerShell