Archive for February, 2017

Installing vCenter for ESXi 6.0

Posted: February 22, 2017 in VMWare

In this post i’ll install vCenter on Windows Server 2016 with SQL database located on separate server.

vCenter Server is an application that is used as a centralized management tool for ESXi hosts and  VMs. vCenter Server performs tasks on the individual ESXi hosts that have been added as members of a vCenter

vCenter server must have at least 8 GB of RAM

Configuring SQL server

I’ll use Windows authentication,so first step would be to create login and map it to Windows user account (standard domain user)

In SQL management studio Expand Security-Right click Login-New Login

 

1

 

Check Windows authentication-Search

 

2.png

Location-domain name-enter domain user name (esxi_user in my case)

 

3.png

 

Creating database

vCenter needs database for storing it’s data.Right click database-New database

 

4.png

Specify new login as database owner

 

5.png

 

Set this login as owner of msdb database but only during vCenter installation,after installation finishes,restore sa account as msdb owner

 

6.png

 

 

Setting vCenter server

vCenter server needs to have access to SQL server database during installation

 

Download and install SQL native client from https://www.microsoft.com/en-us/download/details.aspx?id=50402 (sqlncli.msi)

 

7.png

 

Control Panel-Administrative tools-ODBC Data Sources (64-bit)

 

8.png

 

Select System DSN-Add-SQL Server Native Client-Finish

 

9.png

After clicking Finish,Create a New Data Source wizard opens-set name,from drop-down list choose SQL server and click Next

 

10

Check Integrated Windows authentication and click Next

 

11.PNG

Click Change the default database to: and from drop-down list select database for vCenter and click Next

 

12.PNG

 

Click Test data source and if everything is fine,click OK

 

13.png

Installing vCenter (NET Framework 3.5 is required)

 

14.PNG

 

The Platform Services Controller (PSC) enables  log in and administer vCenter,so it must be installed

 

15.PNG

Set System name

 

16.PNG

Set password for SSO administrator

 

 

17.PNG

Service account must be specified if we want to use Windows authentication

 

 

18

 

 

19

We must add System account Log on as service right,on Domain controller create/edit GPO

Windows Settings-Security Settings-Local Policies-User Right Assignment-Log on as a service-Add account

 

20.png

 

on vCenter server run gpudate /force and click next,error should disappear-click Next

Select DSN Name (created in previous steps)

 

21

 

 

 

22.PNG

 

 

 

23

 

 

After installation we can see that setup created a bunch of tables for databases

 

24.PNG

 

 

25.PNG

 

 

Unattended install ESXi 6.0

Posted: February 21, 2017 in VMWare

Creating ks.cfg file

This specify install location,root password,network settings and hostname

# Sample scripted installation file
#
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI and Tech Support Mode
rootpw mypassword
# Install on the first local disk available on machine
install --firstdisk=local --overwritevmfs
# Set the network to static on the first network adapter
network --bootproto=static --device=vmnic0 --ip=192.168.0.10 --netmask=255.255.255.0 --gateway=192.168.0.1 --nameserver=8.8.8.8 --hostname=esx1.test.com
# A sample post-install script
%post --interpreter=python --ignorefailure=true
import time
stampFile = open('/finished.stamp', mode='w')
stampFile.write( time.asctime() )

I copied this file to USB stick (must be formatted as FAT32!!)

We need to specify path to unattended file (Shift+O)

 

1

ks=usb (specifies usb as ks.cfg file location-installer will search for all USB drives formated as FAT16/32)

 

2

Installation has finished:

 

1.png

In one of my previous posts i installed nano server.Now we’ll deploy Windows container to Nano server.

A container is an isolated place where an application can run without affecting the rest of the system, and without the system affecting the application.Container shares OS kernel so it can be seen as “isolated” part of guest OS.

Windows Containers include two different container types

Windows Server Containers – A Windows Server container shares a kernel with the container host and all containers running on the host.

Hyper-V Containers – expand on the isolation provided by Windows Server Containers by running each container in a Hyper-V virtual machine. In this configuration the kernel of the container host is not shared with other Hyper-V Containers.

Connecting to Nano Server

Set-Item WSMan:\localhost\Client\TrustedHosts 192.168.1.20 -Force
Enter-PSSession -ComputerName 192.168.1.50 -Credential Administrator

Updating Nano Server

#Scan for updates

$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=0";OnlineScan=$true}
$result.Updates

# Install all updates

$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
Invoke-CimMethod -InputObject $ci -MethodName ApplyApplicableUpdates

Restart-Computer

# List Installed Updates

$ci = New-CimInstance -Namespace root/Microsoft/Windows/WindowsUpdate -ClassName MSFT_WUOperationsSession
$result = $ci | Invoke-CimMethod -MethodName ScanForUpdates -Arguments @{SearchCriteria="IsInstalled=1";OnlineScan=$true}
$result.Updates

Installing Container

#Install the OneGet PowerShell module,it's container provider

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
#Use OneGet to install the latest version of Docker.
Install-Package -Name docker -ProviderName DockerMsftProvider
Restart-Computer

capture

Afrer rebooting start Docker service and install base image

Start-Service docker
docker pull microsoft/nanoserver

Enabling remote access to docker host (Nano Server)

netsh advfirewall firewall add rule name="Docker daemon " dir=in action=allow protocol=TCP localport=2375
Stop-Service docker
dockerd --unregister-service
dockerd -H npipe:// -H 0.0.0.0:2375 --register-service
Start-Service docker

Connecting to Windows container from remote computer

#Download docker client
Invoke-WebRequest "https://download.docker.com/components/engine/windows-server/cs-1.12/docker.zip" -OutFile "$env:TEMP\docker.zip" -UseBasicParsing

#extract it
Expand-Archive -Path "$env:TEMP\docker.zip" -DestinationPath $env:ProgramFiles

# For quick use, does not require shell to be restarted.
$env:path += ";c:\program files\docker"

# add docker directory to system path
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Docker", [EnvironmentVariableTarget]::Machine)

Connect to docker container hosted on Nano Server (192.168.0.20),this command will create container from microsoft/nanoserver image with name nano and container hostname nano

docker -H tcp://192.168.0.20:2375 run -it --name nano --hostname nano microsoft/nanoserver cmd

1.PNG

The goal of Storage Spaces is to create highly available storage solution that has all the advantages of SAN (power and flexibility),but is significantly cheaper.Storage spaces “virtualizes” storage (which consist of HDD and SSD.A storage pool is a container that is used to group physical disks (mixing SSD and HDD).It provides the ability to store more frequently accessed data on SSD media,with both types of media used as block based storage for the same virtual disk: the best of both types of storage

In this lab i used machine VMWare workstation VM with 4 HDD and 2 SSD disks (each with 10 GB)

To simulate SSD disk in VMWare,we need to edit virtual machine’s vmx file

scsix:y.virtualSSD=1,where x:y is scsi disk number

1.png

Check VM configuration:

Get-PhysicalDisk -CanPool $true | sort size |ft deviceid,friendlyname,canpool,size,mediatype -AutoSize

2.PNG

As we can see,non-SSD disks are specified as “unspecified”,we need to set its media type as HDD,in order to avoid errors

Get-PhysicalDisk | where MediaType -EQ unspecified | where Size -LT 60GB | Set-PhysicalDisk -MediaType HDD

i used filter to exclude system disk (60 GB) because that disk won’t be member of storage pool

Get-PhysicalDisk | sort size |ft deviceid,friendlyname,canpool,size,mediatype -AutoSize

untitled

Create storage pool

$pool=Get-StorageSubSystem
New-StoragePool -StorageSubSystemUniqueId $pool.UniqueId -FriendlyName mypool -PhysicalDisks (Get-PhysicalDisk -CanPool $true)

3

Get-StoragePool mypool | Get-PhysicalDisk | ft FriendlyName,MediaType,Size

4

Configuring Tiers

As we mentioned before,we need to create storage tiers to group SSD and HDD media types

Get-StoragePool mypool | New-StorageTier –FriendlyName HDDTier –MediaType HDD
Get-StoragePool mypool | New-StorageTier -FriendlyName SSDTier -MediaType SSD

Get Pool capacity

Get-StoragePool mypool | fl Size,AllocatedSize

6

Storage Spaces reserves 256 MB for each disk (6×256=1,5 GB)

Get Tier capacity

HDD tier (mirror):

Get-StorageTierSupportedSize hddtier -ResiliencySettingName mirror | ft -AutoSize

5-1

If we want to use tier in “mirror” mode,maximum space is 8 GB (10+10)/2

SSD tier 

Get-StorageTierSupportedSize ssdtier -ResiliencySettingName mirror | ft -AutoSize

5-2

Maximum free space is 16 GB

Configuring resilency settings

Storage Spaces offers increased performance by striping data across multiple disks,these disks are named NumberOfColumns.NumberOfDataCopiesDefault parameter specifies on how many disks data will be stripped across

Get-StoragePool mypool | Set-ResiliencySetting -Name mirror -NumberOfDataCopiesDefault 2

 Creating mirrored spaces with tiering

$ssd=Get-StorageTier -FriendlyName ssdtier
$hdd=Get-StorageTier -FriendlyName hddtier
Get-StoragePool mypool | New-VirtualDisk -FriendlyName space1 -ResiliencySettingName mirror -StorageTiers $ssd,$hdd -StorageTierSizes 16gb,8gb -WriteCacheSize 1gb
Get-VirtualDisk | ft -AutoSize

untitled

Creating Partition and Volume

Get-VirtualDisk Space1 | Get-Disk | Set-Disk -IsReadOnly 0
Get-VirtualDisk Space1 | Get-Disk | Set-Disk -IsOffline 0
Get-VirtualDisk Space1 | Get-Disk | Initialize-Disk -PartitionStyle GPT
Get-VirtualDisk Space1 | Get-Disk | New-Partition -DriveLetter "F" -UseMaximumSize
Initialize-Volume -DriveLetter “F” -FileSystem NTFS -Confirm:$false

 

Upgrading SCCM 1606 to 1610

Posted: February 10, 2017 in SCCM

For full features of 1610 take a look at technet link.

Before performing upgrade,go to upgrade check-list and perform site backup

Upgrade is done using console only (no download link)

 

Downloading update

Administration-Cloud Services-Updates and Services-Check for updates

 

1.png

You should see 1610 update in the console in “Downloading” state (Check C:\Program Files\Microsoft Configuration Manager\Logs\dmpdownloader.log for status)

 

2.png

 

3.PNG

Update files are downloaded to \Microsoft Configuration Manager\EasySetupPayload folder

 

4.PNG

We can aslo monitor download status using Resource Manager

 

5.png

 

Prerequisite check

 

After download,status is changed to “Available”-right click to update-Run Prerequisite check

 

6.png

Status can be tracked from C:\ConfigMgrPrereq.log

 

7.PNG

Or Monitoring-Distribution Status-Updates and Servicing Status-Right click on update-Show status

 

8.png

 

9.png

 

Starting update

 

After prerequisite steps are completed,perform actual installation by right clicking on update-Install update pack

 

10.png

 

11

 

12.png

 

 

13.PNG

 

 

14

 

For installation status,again log file C:\Program Files\Microsoft Configuration Manager\Logs\CMUpdate.log or  Monitoring-Distribution Status-Updates and Servicing Status-Right click on update-Show status

 

16.PNG

 

15.PNG

Installation has finished

 

17.PNG

 

Upgrading Console

After console is reopened we’ll be asked for console upgrade

 

18

For progress take a look at C:\ConfigMgrAdminUISetup.log and C:\ConfigMgrAdminUISetupVerbose.log

Checking version

 

19

 

Administration-Site Configuration-Sites-Right click site-General

 

20.png

Client package update check

Software Library-Application Management-Packages-Check Last Update Date for Client Packages,it it’s “out-of-date”,right click on package-Distribute Content-select DP and click finish

 

21

 

22.png

 

Updating Boot images

Check update time

 

22.png

If it’s not close to current time,right click image-Distribute Content

 

23.png

Select Distribution Point

 

24.PNG

 

 

26.png

Upgrading Configuration Management Client

Administration-Site Configuration-Sites-Select site and click Hierarchy settings

 

27.png

Click on Client Upgrade tab-check Upgrase all clients check-box,optionally set time frame

 

28

In this article we’ll install Ubuntu Server 16.04.01 as Hyper-V VM with 2 CPU’s,1 GB of RAM and 20 GB HDD (Note machine is Generation 1,with Gen 2 it didn’t work for me)

new-vm -Name 'ubuntu' -MemoryStartupBytes 512MB -NewVHDPath 'c:\ubuntu\ubuntu.vhd' -SwitchName 'new virtual switch' -NewVHDSizeBytes 20GB -Generation 1 -MaximumBytes 2GB
set-vm -VMName 'ubuntu' -ProcessorCount 2
Get-VM -Name 'ubuntu' | Add-VMDvdDrive
Set-VMDvdDrive -VMName 'ubuntu' -Path 'C:\Users\dragan\Downloads\ubuntu-16.04.1-server-amd64.iso'

 

1.PNG

 

 

Enabling SSH access on Ubuntu

I don’t know for you,but it’s very uncomfortable to work from Hyper-V console,that’s why i prefer SSH access

apt-get install openssh-server -y
service sshd restart

Allow ssh traffic to your Ubuntu server (192.168.0.48)

ufw allow proto tcp from 192.168.0.0 to 192.168.0.48 port 22

Download and install Putty.You should be able now to make connection to Ubuntu Server via port 22

 

1

Installing integration services

Hyper-V Integration Services allow a virtual machine to communicate with the Hyper-V host .(Think of it as equivalent of VMWare tools).These services enables,for example,guest file copy, while others are important to the virtual machine’s ability to function correctly, such as time synchronization.

apt-get install --install-recommends linux-tools-virtual-lts-xenial linux-cloud-tools-virtual-lts-xenial linux-virtual-lts-xenial

Reboot the Ubuntu Server

If we want to copy files to VM we need to enable Guest Service interface (disabled by default)

On Hyper-V host check current status:

Get-VMIntegrationService -VMName 'ubuntu'

 

capture

Enable-VMIntegrationService -VMname 'ubuntu' -Name 'guest service interface'

Copying file from Hyper-V host to Ubuntu VM:

echo 'This file is about to be copied to ubuntu server'>c:\file.txt
Copy-VMFile -name 'ubuntu' -SourcePath 'C:\file.txt' -DestinationPath '/root/' -FileSource Host

 

1.PNG