Wednesday, April 15, 2015

Monday, April 13, 2015

Sample scripts for dsadd, dsmodify, dsget, dsquery, dsmod, dsmove

AddUsers.bat
dsadd ou “OU=Sales,DC=worldwideimporters,DC=com”
dsadd ou “OU=Marketing and Finance,DC=worldwideimporters,DC=com”
dsadd user “CN=KimA,OU=Sales,DC=worldwideimporters,DC=com”
dsadd user “CN=SeanA,Ou=Sales,DC=worldwideimporters,DC=com”
dsadd user “CN=NeilC,Ou=Sales,DC=worldwideimporters,DC=com”
dsadd user “CN=AaronC,Ou=Sales,DC=worldwideimporters,DC=com”
dsadd user “CN=AndrewH,Ou=Sales,DC=worldwideimporters,DC=com”
dsadd user “CN=DonH,Ou=Marketing and Finance,DC=worldwideimporters,DC=com”
dsadd user “Cn=GarthF,Ou=Marketing and Finance,DC=worldwideimporters,DC=com”
dsadd user “CN=MarkH,Ou=Marketing and Finance,DC=worldwideimporters,DC=com”
dsadd user “CN=JoB,Ou=Marketing and Finance,DC=worldwideimporters,DC=com”
dsadd user “CN=ScottC,Ou=Marketing and Finance,DC=worldwideimporters,DC=com”
dsadd group “CN=Sales Users,CN=users,DC=worldwideimporters,DC=com” -scope g
dsadd group “CN=Marketing and Finance Users,CN=users,DC=worldwideimporters,DC=com” -scope g
dsadd group “CN=Sales Data,CN=users,DC=worldwideimporters,DC=com” -scope l
dsadd group “CN=Marketing and Finance Data,CN=users,DC=worldwideimporters,DC=com” -scope l
dsadd computer “CN=SALESWKSTN1,OU=Sales,DC=worldwideimporters,DC=com”
dsadd computer “CN=SALESWKSTN2,OU=Sales,DC=worldwideimporters,DC=com”
dsadd computer “CN=MAFWKSTN1,OU=Marketing and Finance,DC=worldwideimporters,DC=com”
dsadd computer “CN=MAFWKSTN2,OU=Marketing and Finance,DC=worldwideimporters,DC=com”
ModifyMembers.bat
dsmod group “CN=Marketing and Finance users,CN=users,DC=worldwideimporters,DC=com” -addmbr “CN=KimA,OU=Marketing and Finance,DC=worldwideimporters,DC=com” “CN=SeanA,OU=Marketing and Finance,DC=worldwideimporters,DC=com” “CN=AaronC,OU=Marketing and Finance,DC=worldwideimporters,DC=com”
dsmod user “CN=KimA,OU=Marketing and Finance,DC=worldwideimporters,Dc=com” “CN=SeanA,OU=Marketing and Finance,DC=worldwideimporters,DC=com” “CN=AaronC,OU=Marketing and Finance,DC=worldwideimporters,DC=com” -pwd Abcd123 -mustchpwd yes
MoveUsers.bat
dsmove “CN=KimA,OU=Sales,DC=worldwideimporters,DC=com” -newparent “OU=Marketing and Finance,DC=worldwideimporters,DC=com”
dsmove “CN=AaronC,OU=Sales,DC=worldwideimporters,DC=com” -newparent “OU=Marketing and Finance,DC=worldwideimporters,DC=com”
dsmove “CN=SeanA,OU=Sales,DC=worldwideimporters,DC=com” -newparent “OU=Marketing and Finance,DC=worldwideimporters,DC=com”ModifyMembers.bat
QueryUsers.bat
dsget user “CN=KimA,OU=Sales,DC=worldwideimporters,DC=Com” -memberof -expand >”c:\documents and Settings\All Users\Desktop\userinfo.txt
dsquery user “OU=Sales,DC=worldwideimporters,DC=com” >>”c:\documents and Settings\All Users\Desktop\userinfo.txt
dsquery user “OU=Marketing and Finance,DC=worldwideimporters,DC=com” >>”c:\documents and Settings\All Users\Desktop\userinfo.txt
Notepad “c:\documents and Settings\All Users\Desktop\userinfo.txt
Remove1.bat
dsrm -noprompt -c “cn=KimA,OU=Marketing and Finance,DC=worldwideimporters,DC=com”
dsrm -noprompt -c “CN=mafwkstn1,OU=Marketing and Finance,DC=worldwideimporters,DC=com”
dsrm -noprompt -c “CN=Marketing and Finance Users,CN=Users,DC=worldwideimporters,DC=com”
dsrm -subtree -noprompt -c “OU=Marketing and Finance,DC=worldwideimporters,DC=com”
RemoveAll.bat
dsrm -subtree -noprompt -c “OU=Sales,DC=worldwideimporters,DC=com”
dsrm -noprompt -c “CN=Marketing and Finance Data,CN=Users,DC=worldwideimporters,DC=com”
dsrm -noprompt -c “CN=Sales Users,CN=Users,DC=worldwideimporters,DC=com”
dsrm -noprompt -c “CN=Sales data,CN=Users,DC=worldwideimporters,DC=com”

Implementing Hyper-V Backup and Recovery with the Windows Server Backup (WSB)

The Windows Server Backup (WSB) is the built-in feature in Windows Server 2012 and is not an enterprise –wise backup solution. The WSB supports backing up virtual machines on stand-alone hosts and clustered hosts with CSVs. With the improvements in the Windows Server 2012, administrators can select backup and restore virtual machines (VMs) on the same Hyper-V Server. For medium or enterprise organization, Data Protection Manger 2012 R2 is the perfect solution for centralized protection of virtual machines and data. There are also many numbers of third parties backup solutions for Hyper-V. Here, you will use the Windows Server Backup (WSB) feature to backup and restore Virtual machines. The Windows Server Backup (WSB) feature is not installed on a server by default, it must be enabled. There are two ways to enable Windows Server Backup (WSB):
  • From Server Manager
    • Open Server Manager
    • Open the Manage menu and choose Add Roles and Features.
    • On the Before you begin page, click Next.
    • On the Select installation type page, click Next.
    • On the Select destination server page, click Next.
    • On the Select server roles page, click Next.
    • On the Select features page, select the check box Windows Server Backup and click Next.Windows Server backup with Server Manager
    • On the last screen, click on the Install to start the installation of the Windows Server Backup feature on the server.
  • From PowerShellTo install Windows Server Backup feature by using PowerShell command, open up a PowerShell command with an administrative account and then type the following:
    Install-WindowsFeature Windows-Server-BackupInstall Backup Feature
After you have Windows Server Backup feature installed, now it’s ready for backing up a Virtual Machines.
Backing Up Virtual Machines, perform the following steps:
1. Open Server Manager, click Tools menu, and then click Windows Server Backup. In the Windows Server Backup console, in the Actions pane, click Backup Schedule.
1
2. On the Getting Started page, click Next.
2
3. On the Select Backup Configuration page, select Custom for the backup type, and then click Next.
3
4. On the Select Items for Backup page, click Add Items to open the Select Items screen.
4
5. In the Select Items screen page, select the virtual machines that you would like to backup with this scheduled job and then click OK.
5
6. Back in the Select Items for Backup page, click the Advanced Settings, and then select the VSS Settings tab, and then choose VSS full Backup and click OK(Note: If you’re not using any other backup product to protect your VMs).
6
6i
7. On the Select Items for Backup page, click Next.
7
8. On the Specify Backup Time, select Once a day and select time of day, and then click Next.
8
9. On the Specify Destination Type page, select Back up to a hard disk that is dedicated for backups (recommended) and then click Next. To use this option, you must have at least one disk attached to the server that has no existing volume. The disk should be raw, with no partition of file system.
9
10. On the Select Destination Disk page, select the available disks and then click Next.
10
11. On the Windows Server Backup dialog box, click Yes to accept the warned that finish this wizard, the selected disks will be reformatted and all the existing volumes and data on the disks will be deleted.
11
12. On the Confirmation page, review the selected options, and then click Finish to format the disks and schedule the backup.
12
13. On the Summary page, status showing Formatting disk.. and Creating backup schedule..
13
13i
14. On the Summary page, showing status You have successfully created the backup schedule and clickclose.
14
15. On the Windows Server Backup console, click Backup Once.. to run scheduled backup right now.
15
16. On the Backup Options page, select scheduled backup options and click Next.
16
17. On the Confirmation page, verify the backup items and then click Backup.
17
18. On the Backup Progress page, showing status Creating shadow copy of volumes..
18
19. On the Backup Progress page, showing status Backup in progress for application: HyperV.
19
20. On the Backup Progress page, showing status Completed and click Close.
20
21. Backup paths and details.
21
To restore virtual machines from Backup, you will perform full deletion of virtual machine, KTM-FS-2K12 from the Hyper-V host in our environment, which you backed up in the previous section.
Deleted VM
Deleted1
Restoring virtual machine from Windows Server Backup feature, perform the following steps:
1. Open the Window Server Backup console. In the Actions pane, click Recover..
1
2. On the Getting started page, select This server (KTM-HOST1) option to specify that the backup stored that you want to use for the recovery, and then click Next.
2
3. On the Select Backup Date page, select the appropriate backup date and then click Next.
3
4. On the Select Recovery Type page, select Hyper-V as the backup type and click Next.
4
5. On the Select items to Recover page, select the virtual machine you want to recover, and then clickNext.
5
6. On the Specify Recovery Options page, select Recover to original location option and then click Next.
6
7. On the Confirmation page, verify the recovery itemsbackup date, and then click Recover.
7
8. On the Recovery Progress page, status showing Recovery in progress.. Upon completion of the virtual machine recovery process, Windows Server Backup will provide with you confirmation about the successful restore of the virtual machine as follows and then click Close.
8
8i

8ii
9. For the restored virtual machine confirmation, Open Hyper-V Manager and try to locate VM, KTM-FS-2K12, in the available virtual machines.
verify vm is stored


Friday, April 10, 2015

Migrating Active Directory Domain Controller from Windows Server 2008 R2 to Windows Server 2012

Windows Server 2012 is the Microsoft latest Windows Server Operating System which is more powerful than previous versions of Windows Server. For examples, Hyper-V replication, DHCP failover, Dynamic Access Control, Improvements in Active Directory Recycle Bin, Virtual Domain Controller etc. So it’s better to migrate Windows Server 2008 R2 to Windows Server 2012 Domain Controller because of the new cool features of Windows Server 2012. There are two options for migrating Windows Server 2008 R2 to Windows Server 2012 Domain Controller.
  1. Directly Upgrading to Windows Server 2012 on same physical machine, which is not recommended?
  2. Migrating specific domain controller functionality to the new Windows Server 2012 Active Directory Domain environment using new hardware, which is the best option for migrating Active Directory Domain Controller from Windows Server 2008 R2 to Windows Server 2012 Domain Controller.
The prerequisites for migrating to Windows Server 2012 in a new hardware are as follows:
  1. Windows Server 2008 R2 AD DS Domain and Forest functional level must be minimum Windows Server 2003 or higher recommended.
  2. Check the Schema version of AD DS.
  3. Forest and Domains must be prepared Using adprep. In Windows Server 2008 R2 Domain Controller, run adprep /forestprep and adprep /domainprep from the Windows Server 2012 installation DVD \support\adprep folder.
Step 1: Run adprep command to prepare the existing forest:
1.  Insert the Windows Server 2012 DVD into the DVD drive of the Windows Server 2008 R2 AD DS.
2.  Open command prompt, and type the following commands and press enter.


3.  
Check the Schema version of AD DS.
       Before Adprep
After Adprep
 Step 2: Promote a Windows Server 2012 Server to a domain controller, including DNS and Global Catalog:
1.  First Joining this server, KTM-DC01-2K12, as a member server in the existing Window Server 2008 R2 Domain before promoting to Domain Controller.
2. On the server KTM-DC01-2K12, in Server Manager, click Manage, and from the drop-down list box, clickAdd Roles and Features.
3. On the Before you begin page, click Next.
4. On the Select installation type page, confirm that Role-based or feature-based installation is selected, and then click Next.
5. On the Select destination server page, ensure that Select a server from the server pool is selected, and that KTM-DC02-2K12  is highlighted, and then click Next.
6. On the Select server roles page, click Active Directory Domain Services.
7.  On the Add features that are required for Active Directory Domain Services? Page, click Add Feaures.
8.  On the Select server roles page, click Next.
9. On the Select features page, click Next.
10. On the Active Directory Domain Services page, click Next.
11. On the Confirm installation selections page, click Install. (This may take a few minutes to complete.)

12. When the Active Directory Domain Services (AD DS) binaries have installed, click the blue Promote this server to a domain controller link.
13. In the Deployment Configuration window, click Add a domain controller to an existing domainSpecify the domain information for this operation Domain: msserverpro.com and then click Next.
14. In the Domain Controller Options windows, ensure that both the Domain Name System (DNS) serverand Global Catalog (GC) check boxes are selected. Confirm that Site Name: is set to Default-First-Site-Name. Under Type the Directory Services Restore Mode (DSRM) password, type P@ssw0rd in both text boxes and then click Next.
15. On the DNS Options page, click Next.
16.  On the Additional Options page, select KTM-DC01-2K8.msserverpro.com in the Replicate from drop-down box.
17. On the Paths windows, click Next.
18. On the Review Options windows, click Next.
19. On the Prerequisites Check windows, confirm that there are no issues, and then click Install.
20. Installation Process begins.. and server will automatically reboot after Installation Finished.

Step 3: Verify the Domain Controller:
1. Open Active Directory Users and Computers, expand mserverpro.com and click Domain Controller OU .Verify KTM-DC01-2K12 Server is listed.
2. Open DNS Manager, right-click on msserverpro.com and select Properties and then click Name Servers Tab. Verify that KTM-DC01-2K12.msserverpro.com is listed in Name Servers: lists.
3. Open Active Directory Sites and Servicesverify that KTM-DC01-2K12 is listed in Servers underDefault-First-Site-Name.

Step 4: Transfer FSMO roles to the Windows Server 2012 Domain Controller:
1. Log on KTM-DC01-2K12 new domain controller, Open the Command Prompt and type   netdom query fsmo.
2. Verify the FSMO Roles on Windows Server 2008 R2 Server(KTM-DC01-2K8)  before we transfers FSMO roles to new Windows Server 2012 Server( KTM-DC01-2K12).
3. In the command prompt, type ntdsutil and press enter.
4. Type roles and press Enter. The prompt will display “fsmo maintenance:”
5.  Type connections and press Enter. The prompt will display “server connections:”
6.  In the “server connections: “, type connect to server KTM-DC01-2K12.msserverpro.com and press enter ( where KTM-DC01-2K12 is the name of the target Windows Server 2012)
7.  Type quit and press enter. The prompt will display “fsmo maintenance:”
8.  In the “fsmo maintenance:” type “?” for help
9. In the “fsmo maintenance: “ , type transfer schema master and Press enter and Click Yes On Role Transfer Confirmation Dialog box to confirm the Operations Master change.

10. Do the same process for: transfer naming master, transfer PDC, transfer RID master and transfer infrastructure master.
11. Type quit and press enter; the type quit and press enter again to exit the ntdsutil.
12. Verify the FSMO Roles on new Windows Server 2012 Domain Controller, KTM-DC01-2K12.
Step 5: Remove the legacy domain controller:
1. On KTM-DC01-2K8, Click Start, Click Run, type dcpromo and then click OK.
2.  On the Welcome to the Active Directory Installation Wizard page, Click Next.
3. On the Delete the Domain page, leave Delete the domain because this server is the last domain controller in the domain.
4. On the Administrator Password Page, type P@ssw0rd in both password textboxes and click Next.
5. On the Summary page, click Next. Wait for the process to complete and then click Finish.
6. On the Completing the Active Directory Domain Services Installation Wizard, click Finish.
7. On the Active Directory Domain Services Installation Wizard page, click Restart Now to Restart the server.
8. After restart the server, KTM-DC01-2K8 computer account will automatically move from Domain Controller OU to Computers OU because now KTM-DC01-2K8 is only the member server.
9. Lastly disjoin Windows Server 2008 R2 (KTM-DC01-2K8) from the domain to a workgroup and remove any unnecessary record from Active Directory Sites and Services.