PowerTip: Create a New User in Active Directory with PowerShell

Summary: Use the Active Directory module to create a user with Windows PowerShell.    How can I create a user in Active Directory with PowerShell?  In Windows Server 2012 R2 or Windows Server 2008 R2, use the New-ADUser cmdlet.   To create a new user named “Doctor Scripto” in Active Directory:   NEW-ADUSER doctor.scripto –Givenname…


Building a Demo Active Directory: Part 4

Summary: Use Windows PowerShell to generate random users in Active Directory.  Hey, Scripting Guy! Is there an easy way to take a list of names and generate random combinations for sample users in Active Directory? —LD  Hello LD, Honorary Scripting Guy, Sean Kearney here, filling in for our good friend, Ed. To catch up on…


PowerTip: Create an Active Directory Group with PowerShell

Summary: Use Windows PowerShell to create a security group in Active Directory.  How can I use Windows PowerShell to create a security group in Active Directory?  In Windows Server 2012 R2 or Windows Server 2008 R2, use the New-ADGroup cmdlet. To create a new global group in the default Users folder of Active Directory called “Finance”: NEW-ADGroup –name “Finance” –groupscope…


Building a Demo Active Directory: Part 3

Summary: Create security groups in targeted organizational units in Active Directory.  Hey, Scripting Guy! I was wondering if you could please show me how to use Windows PowerShell to create some security groups inside a set of organizational units in Active Directory. Is it difficult? —DS  Hello DS, Honorary Scripting Guy, Sean Kearney here, filling…


PowerTip: Create an Organizational Unit with PowerShell

Summary: Use Windows PowerShell to create an organizational unit in Active Directory.  How can I use Windows PowerShell to create an OU in my Active Directory?  In Windows Server 2012 R2 or Windows Server 2008 R2, use the New-ADOrganizationalUnit cmdlet. To create a new OU at the root of Active Directory called “Divisions”: NEW-ADOrganizationalUnit “Divisions” If it needs to exist…


Building a Demo Active Directory: Part 2

Summary: Build Windows PowerShell variables to design an organizational unit structure.  Hey, Scripting Guy! Can Windows PowerShell provide a consistent way to build a demo structure in Active Directory that includes organizational units and security groups? —RL  Hello RL, Honorary Scripting Guy, Sean Kearney here, filling in for our good friend, Ed. Welcome to Part…


PowerTip: Rename a Computer with PowerShell

Summary: Use Windows PowerShell to rename a newly created computer.  How can I use Windows PowerShell to rename a computer if I don’t know the machine name?  Use the Rename-Computer cmdlet and the built in HOSTNAME command, then reboot the computer.           For example, to rename a computer to called MININT-123 to CONTOSO-FS: RENAME-COMPUTER –computername MININT-123…


Building a Demo Active Directory: Part 1

Summary: Leverage Windows PowerShell in Windows Server 2012 to create a new Active Directory forest.  Hey, Scripting Guy! I often have to put together demo environments, and I need a new empty Active Directory forest. Is there any way I can do this faster than by using the GUI…maybe with Windows PowerShell? —TM  Hello TM, Honorary…


PowerTip: Use CIM Cmdlets to Find WMI Classes

Summary: Use the CIM cmdlets in Windows PowerShell to find associated WMI classes.  How can I find the associated classes for a WMI object?  Use the Windows PowerShell 3.0 CIM cmdlets. First get the WMI object for which you want find the associated classes: $group = Get-CimInstance -ClassName Win32_Group  -Filter “Name = ‘Administrators’” Then find the…