Monday, April 24, 2017

Windows Server 2016 installation

We will look at different steps to complete the basic installation of Windows Server 2016.

The first step obviously is to check the System Requirements which can be found here.

Windows Server 2016 can be installed on a physical or a virtual server and supported by many hypervisors. If you are installing in a virtual machine, you may need to mount the ISO file and boot with that. In case you want to create a bootable USB Flash Disk for Windows Server 2016, please check the details here.

When the computer boots and reads the disk, you are presented with language preferences. I will proceed with English (United States) and US keyboard layout. If you have different one, please choose accordingly.
 
 
Press Install Now button. If you are performing a system restore, you can click on Repair your computer link.

 
 
At this moment, you are provided 4 options for installation. You can either install Windows Server 2016 with or without GUI. When you install Windows Server without GUI, you will be limited to using Powershell commands, or managing it through GUI from a remote server. You may also note that Windows Server 2016 now comes with only two editions; Standard and Datacenter. More details about their differences and capabilities can be found here.

 

You will be presented with Applicable notices and license terms. Click on the checkbox to accept and press Next.


In the next screen you can choose to either have a fresh install or upgrade Windows. If you upgrade, the old system and Windows files are kept in Windows.old folder and new operating system will be installed in C:\Windows (Or the path of your choice).


Next you have to choose which partition of disk will be used to host Windows. In this scenario, we have only one disk visible. If you don't see the disk that your computer has attached, you may need to load drivers. If you have no partitions made already, you can create one. You will also note that Windows will make an extra partition of 500 MB for storing some system and boot files. After you have your partition selected, press Next button.

 
 
 
 
Now Windows will be installed on your system and all files will be copied. Upon completion, Windows will restart and you will presented with Customize Settings screen to set new password of Administrator. Enter new password twice and press Next button.


Press Ctrl+Alt+Del button to logon to Windows.

 
 
Upon pressing Windows button, you will presented with new Start menu which is similar to Windows 10 and provides most of the administrative tools here.

 
You can also click on Action Center button on bottom right (almost) of screen. Here you can use these settings for easy access to some of the essential tools.

 
The next step (after assigning IP) is to activate Windows, set the name of the server, join it to domain, change Remote settings and install any missing drivers of installed devices. For this, right click on Start button and select System (Or press Winkey+Pause button)

 

So you have installed Windows Server 2016 successfully. Now you may need to install required roles and services on the server. Enjoy!

Windows Server 2016 bootable USB Flash Disk

Information:

If you acquire ISO or DVD of Windows Server 2016, you be in need of creating a bootable USB flash disk. To do so, you must have the following:
  1. Windows Server 2016 DVD or ISO image.
  2. USB Flash Disk (8 GB or more)
Caution: This is a destructive process and all data on the USB Flash Disk will be removed without any prompt or warning. Therefore, it is highly advisable to either use an empty flash disk, or take a backup of all data on the disk.

Preparation:

If you have a DVD, insert it into DVD Drive. If you have an ISO, mount it to a virtual Drive (You may need to have external tool for this). For the sake of this exercise, we assume that the drive letter F: is assigned to the DVD drive or virtual drive.

Plug the USB disk on your computer. We assume that the drive letter G: is assigned to the USB Disk. If there is any data on the USB disk, take a backup before proceeding further.

Execution:

Open Command prompt with Administrative privileges, and perform the following commands in sequence.

C:\WINDOWS\system32>diskpartMicrosoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: ****

 
DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online          931 GB  1024 KB   *
  Disk 1    Online          931 GB   101 MB   *
  Disk 2    Online         7633 MB      0 B


Please note the output of list disk command. In above screen, disk 0 and disk 1 are hard disks and disk 2 is the USB disk. The output does not show CD/DVD or mapped drives.

DISKPART> select disk 2
Disk 2 is now the selected disk.

At this moment, disk 2 is selected. All the following operations will be applied to Disk 2. If you select a wrong disk and run below commands, you may lose data. Therefore, be very careful in selecting right disk. Again to re-emphasize, the following command will delete all data on the USB disk, so make sure you have backup of your data.

DISKPART> clean
DiskPart succeeded in cleaning the disk.

At this moment, all data on the USB disk is destroyed.

DISKPART> create partition primary
DiskPart succeeded in creating the specified partition.
DISKPART> select partition 1
Partition 1 is now the selected partition.
DISKPART> active
DiskPart marked the current partition as active.
DISKPART> format fs=ntfs quick
100 percent completed
DiskPart successfully formatted the volume.
DISKPART> exit
Leaving DiskPart...

At this moment, the USB disk has one partition which has been marked as active and formatted with NTFS file system. Now we will make the USB disk bootable by copying the boot sector. F: drive has our source media, and G: drive is our USB Disk.
C:\WINDOWS\system32>f:
F:\>cd boot
F:\boot>bootsect /nt60 g:
Target volumes will be updated with BOOTMGR compatible bootcode.

G: (\\?\Volume{---------------})
Successfully updated NTFS filesystem bootcode.
Bootcode was successfully updated on all targeted volumes.



At this moment, the USB disk has been made bootable. Now we will copy all files from the media. You can copy the files by using below command or select all files/folders from F:\ and paste on G:\. If using drag and drop option, make sure you have made hidden files visible from options.
F:\boot>CD ..
F:\>xcopy f:\* g: /H /F /E

The copy process will take some time, especially at install.wim file which is around 4.5 GB in size. If you don't see any progress for some time while copying this file, don't panic and wait till the process completes.

Usage:

To use this bootable USB disk, you must attach it to the server and boot. You may need to change the boot sequence to make sure USB disk is tried first while booting.
 

Thursday, April 20, 2017

Script to update password of service accounts

It is always a nightmare for administrators to update the passwords of service accounts whenever they are changed. This script can help find the services using the account and update the password and restart the services.

Save he below code to ChangeSvcPwd.vbs and run by passing Server Name, Service User account and new password as parameters.

Script to inventory members of Administrators group in all computers in domain

A very frequent requirement for every administrator to list members of Administrators group of all computers (servers and desktops) in the domain. The script below can be used to run to get a csv file with a list of all computers in the domain and the members of Administrators local group. The type of member (User, Computer or Group) will be provided.

The output of the script is saved in file "AdminMembers.csv" file at the same path of script. The script also uses a temporary file "c:\RunResult.tmp" to store ping results to verify if the computer is online or not. Both can be modified in the script to values of your choice.




Script to add an active directory user to Administrators group of a remote computer

It is needed to add users to Administrators group of Servers and Desktops. To do so, we can either access the remote computer and open Administrators group and add the users. This is time consuming and needs lot of effort. The other option is to run this script to add users to Administrators group. Save the script to file add2admins.vbs, update domain name and pass the username and computername as parameter.

Usage:

>cscript add2admins.vbs username computername


'-------- Script Start -----------
DomainName = "domainname"
UserAccount = wscript.arguments(0)
sComputer = wscript.arguments(1)
set Group = GetObject("WinNT://" + sComputer + "/Administrators,group")
group.Add "WinNT://"& DomainName &"/"& UserAccount &""
wscript.echo "Done! " & now

'--------Script End-------------

Windows Server 2016 installation

We will look at different steps to complete the basic installation of Windows Server 2016. The first step obviously is to check the Syste...