2013/07/18

PowerShell - Free Trainings from Microsoft Virtual Academy

Update: Getting Started with PowerShell 3.0 and Advanced Tools & Scripting with PowerShell 3.0 recorded videos are now available on Microsoft Virtual Academy. Links below.


I get a lot of questions from my friends and coworkers about PowerShell ...
"Hey FX, How can i get all the process that start by... and then kill them all in PowerShell ?
"How can I add a Windows Feature in W2012 in PowerShell ?"
"How can I get the list of programs installed on those 50 computers using PowerShell ?"
 "How can I change the Multipath policy of all my LUNs in VMware vSphere using PowerShell (PowerCli) ?"

Well if you are just like them, you'll be happy to hear that Microsoft Virtual Academy will offer not one, but Two free PowerShell trainings !! Here are the details.

2013/07/16

WS2012 Storage - iSCSI Target Server - Configuring an iSCSI Initiator on VMware vSphere 5.1


I recently switched the backend storage of my VMware vSphere 5.1 Home Lab from FreeNas (OS based on UNIX) to iSCSI (Windows Server 2012 Storage Feature). The reason is that I wanted to play with the PowerShell iSCSI modules and do some tests with SMB v3.0.

In a previous post I showed how to create an iSCSI target using PowerShell on Windows Server 2012. Today I will demonstrate how I set the VMware vSphere 5.1 Software iSCSI Adapter using PowerCli and create the datastore using the LUN created in my previous post. I won't cover how to assign the iSCSI traffic to a dedicated PortGroup and dedicated NICs.


2013/07/11

WS2012 Storage - iSCSI Target Server - Create an iSCSI target using PowerShell

For my Virtual Machines needs, some LUNS are presented to my VMware vSphere 5.1 Servers and until now, my lab storage was handle by FreeNas using iSCSI.
For tests purposes, I replaced this FreeNas by Windows Server 2012 to take care of that part.

Note: Before writing this post, I grouped my physical disks together into a container called storage pools to manage those disks as a single storage space. Afterwards, in these storage pools, I created virtual disks (aka LUN) on which I specify a layout, ... which is simply a raid level.


Overview

In the following post I will talk about the following points:
  • Quick iSCSI Terminology
  • Quick look at iSCSI Target Management (GUI and PowerShell iSCSI Modules)
  • Installing the Windows Feature iSCSI Server Target (PowerShell)
  • Creating a iSCSI Virtual Disk (aka LUN) (PowerShell)
  • Creating a iSCSI Target and assigning it to one or more initiator(s) (PowerShell)
    • Finding the iSCSI Qualified Name (IQN) (vSphere Client and PowerCLI)
  • Assigning a iSCSI Virtual Disk (LUN) to a iSCSI Target (PowerShell) 


Terminology


Note: The iSCSI protocol is fully documented by the RFC 3720 and RFC 3721

iSCSI: iSCSI stands for Internet Small Computer System Interface.
It's an Internet Protocol (IP)-based storage networking standard for linking data storage facilities.
iSCSI is used to facilitate data transfers over a network (LAN, WAN or Internet) and transferring data by carrying SCSI commands over IP networks. iSCSI leverages the Ethernet network and does not require any specialized hardware

source: http://blogs.technet.com/b/filecab/

iSCSI Target Server: is the server that shares the storage, it runs the iSCSI Target. The server (machine) consumes the storage is called iSCSI initiator.

iSCSI Initiator: Typically, it is an application server. For example, iSCSI Target provides storage to a SQL server, the SQL server will be the iSCSI initiator in this deployment.

Target: It is an object which allows the iSCSI initiator to make a connection. The Target keeps track of the initiators which are allowed to be connected to it. The Target also keeps track of the iSCSI virtual disks which are associated with it. Once the initiator establishes the connection to the Target, all the iSCSI virtual disks associated with the Target will be accessible by the initiator.

iSCSI Virtual Disk: It also referred to as iSCSI LUN. It is the object which can be mounted by the iSCSI initiator. On Windows Server 2012, the iSCSI virtual disk is backed by the VHD file.

iSCSI Connection: iSCSI initiator makes a connection to the iSCSI Target Server by logging on to a Target. There could be multiple Targets on the iSCSI Target Server, each Target can be accessed by a defined list of initiators. Multiple initiators can make connections to the same Target. However, this type of configuration is only supported with clustering. Because when multiple initiators connects to the same Target, all the initiators can read/write to the same set of iSCSI virtual disks, if there is no clustering (or equivalent process) to govern the disk access, corruption will occur. With Clustering, only one machine is allowed to access the iSCSI virtual disk at one time.

IQN: iSCSI Qualified Name. It is a unique identifier of the Target or Initiator. The Target IQN is shown when it is created on the Server. The initiator IQN can be found by typing a simple "iscsicli" cmd in the command window or using Get-InitiatorPort in PowerShell

Using iscsicli

Using PowerShell (module iSCSI) with the Cmdlet Get-InitiatorPort

2013/07/02

Enabling Change Block Tracking (CBT) on a vSphere 5.1 VM with PowerShell/PowerCli

In one of my previous post, I created two PowerShell functions to enable Copy/Paste operations on VMware vSphere 5.1 between a Guest OS and the vSphere Client remote console.
Today we'll use a very similar piece of code to Enable Change Block Tracking (CBT) on one or more Virtual Machines.

I already talked about CBT in the past, but I just wanted to create re-usable PowerShell functions that will help me when I need it.

2013/07/01

How to Enable Copy/Paste Operations Between GuestOS and Remote Console on vSphere 5.1 (GUI and PowerCli)

In this blogpost I will explain how to enable Copy/Paste operations between the Guest Operating System and the Remote Console on VMware vSphere 5.1 via the GUI and PowerCli (PowerShell for VMware).

VMware does not recommend this manipulation to avoid and limit Exposure of Sensitive Data Copied to the Clipboard section.

Using the GUI this procedure requires the VM(s) to be powered off. Who wants to do that? Not me...

Check the second part of this procedure using PowerCli, this can be applied without powering off the VM. However you'll need to do a stun/unstun operation (i.e. power on/off, suspend/resume, create/delete snapshot/storage VMotion) to achieve the same thing.


Using the Graphical User Interface (GUI)

Applying advanced settings to a VM can be a daunting task.
Doing this manipulation via the GUI is pretty heavy. When dealing with even a few VMs, this can be a very time consuming task time consuming...

The "Configuration Parameters" button is not available while the VM is Powered On.

1 - Power down your VM(s)

2 - Go into Edit Setting, under the Option tab, and select General under Advanced.
You'll see the Configuration Parameters button...



3 - Click on Add Row and enter the Name and Value for each of the following items:
  • isolation.tool.copy.disable = FALSE
  • isolation.tool.paste.disable = FALSE