#PS Script that filters AD Computers and moves it to specified OU

I wrote this script to filter my Active Directory Domain for Computers beginning with “SMB-” and move them to an Organizational Unit (OU) with the name “SMB-OU”.

You can use the script but you have to change the OU, Computer filter and Domain so that it matches your search and domain criteria.

I use the Outfile command to create a logfile from the movement for documentation.

Get-ADComputer -Filter * -Properties name | #get all active directory computers
where { $_.Name -match ‘SMB-*’} | #with computername that includes “SMB-“
Out-File c:\move_resultates_before.txt #writes status before any computer will moved in output file
Get-ADComputer -Filter * -Properties name | #get all active directory computers
where { $_.Name -match ‘SMB-*’} | #with computername that includes “SMB-“
Move-ADObject -TargetPath “OU=SMB-OU, DC=Datacenter-Flo, DC=de” #and moves the computer to OU named SMB-OU in domain Datacenter-Flo.de (you have to change to your domain)
Get-ADComputer -Filter * -Properties name | #get all active directory computers
where { $_.Name -match ‘SMB-*’} | #with computername that includes “SMB-“
Out-File c:\move_resultates_aftwe.txt #writes status after the computers were moved in output file
 

At the moment there is no security and other filters included. Only quick and dirty but it’s working.

How to configure the first Domain Controller in a Windows Server 2012 Domain incl. DNS

Hello Community,

today I will explain how to configure the first Domain Controller in new Windows Server 2012 forest in Windows Server 2012 pure mode.

1. Open the Server Manager and klick on “Add roles and features”

2. The default page will open, click “Next”.

3. select “Role-based or feature-based installation” and click “Next”.

4. Select “Select a server from the server pool” and than select you local system. In my case FLO-SVR-DC01.

5. Now you can select the roles to install. Befor you go on with selecting roles please check if:

– you configured a static IP, Default Gateway, Subnet and DNS on the Network Interface to you client LAN

– Networkcable is connected to your switch

– you have no other Domaincontroller, DHCP- or DNS Server in your network

6. Please select for the first DC

– Active Directory Domain Services

– DNS Server

For every option Windows will ask you to install the “Remote Server Administration Tools” (RSAT). DO THIS otherwise it will be harder to finish the configuration. With later installations you can try to administrate the systems from remote or PowerShell.

7. Now the menu should look nearly like this. If this is the fact, you can click “Next”.

8. Now you have the “Feature selection”. You don’t need to install more features at the moment. Click “Next”

9. Now the Wizzard to configure ADDS starts.

10. Now you can select which operation the DC will perform. We plan to create a new forrest, so please click on “Add a new forest”.

11. Than typ in the name of your Root domain that you have planed e.g. local.company.com. After this click “Next”.

12. In the next Step you have have to select Forest function and domain level. You have to be carefull by selecting the level because some Active Directory Integrated Software e.g. some LDAP connectors, cannot work with Windows Server 2012 Domain Level. So please contact your software vendors first.

Create and set the Directory Services Restore Mode Password. Please also notice it down because you need it for a DC disaster recovery.

After this you can click next.

13. Normaly you could select in this Wizzard a DNS delegation but currently we have no DNS Server in this domain, so we have no option to delegate.

14. Now the NetBIOS Name will created. You are able to change it but you don’t have to do it.

15. After this you can set the Database folder, Log files path and SYSVOLL folder for ADDS Service. You can change the default path but I wouldn’t do this, you only force problems with this.

16. At next you get a install summary and you are able to view the PowerShell Script the will be executed (I love this option!!)

17. After this the Wizzard runs a validation check and when all is ok you can install ADDS.

18. Service installs.

19. After installation is finished you should see ADDS and DNS in your Server Manager

20. Please also look if the DNS Forward lookup Zone for your domain was created.

For this click on “Tools” in the the upper right Corner and select “DNS”.

21. Under Forward Lookup Zones you should the your Domain and there should be a NS, SOA and two A records for your DC.

22. Go back to Server Manager and select “Active Directory Users and Computers” under “Tools”

There your Domain should be listed and in “Domain Controllers” should be the “Computer Account” for your DC

23. Congratulations you installed your DC. In the next Blogs I will explain you how to install and configure DHCP and how to create a Reverse Lookup Zone in DNS.