Tuesday 5 April 2011

Initial VMs configured

So with the Microserver up and running with Hyper-V, I have now started provisioning VMs.


I have got a Windows 2008 R2 VM up and running as a domain contoller, will be posting some scripts soon that I have used to create my test users & groups.



Added to this I have created another Windows 2008 R2 VM that is running Threat Management Gateway (TMG) 2010. This will serve as my firewall between the virtual environment and the internet connection. Whilst also providing proxy services for testing, and VPN access so I can access this whilst working away. Will be getting some posts up soon around TMG.



The plan is also to get a SQL server, Virtual Machine Manager (VMM), File & Print Server & more than likely App-V. All of which I am planning to blog about the installation and configuration.

Thursday 24 February 2011

Change Owner in SCVMM for multiple VMs

The more I use Powershell the more I like how it simplifies administration. Whether you using it with Windows Operating Systems, Exchange, Hyper-V, SCVMM, VMware or the many other uses it can make life much easier.

One of the ways I have used Powershell recently was to update the Owner property of multiple virtual machines in System Center Virtual Machine Manager (SCVMM). What I really liked was just how short the piece of code was to achieve this.

Change Owner for all VMs

$vms = get-vm *
foreach ($vm in $vms)
{
set-vm $vm -Owner *Domain*\*User or Group*
}

Note: Substitute *Domain* for the AD Domain & *User or Group* for the Username or Group.


That is infinitley quicker than right clicking each VM and then changing the owner!!!

So once I saw how easy this was I started to add to it.

In larger Hyper-V & SCVMM implementations it is likely that one the scenarios below may be useful too:

Change Owner for VMs in a predefined list using an array:

$vms = @("vm1","vm2","vm3","vm4","vm5")
foreach ($vm in $vms)
{
set-vm $vm -Owner *Domain*\*User or Group*
}

Note: Substitute *Domain* for the AD Domain and *User or Group* for the Username or Group.



Change Owner for VMs with specific naming standard:

$vms = get-vm *sql*
foreach ($vm in $vms)
{
set-vm $vm -Owner *Domain*\*User or Group*
}

Note: Substitute *Domain* for the AD Domain and *User or Group* for the Username or Group.

Obviously this is only using the -Owner attribute of set-vm. When you look at just how many different options you have with set-vm, there are numerous possibilities of how to make changes to a larger number of VMs in one hit.

This is a very simple start to hopefully what will become a series of blog posts from me on Powershell scripts.

Below are the list of available options for set-vm, so these can all be used in the ways shown above to alter multiple VMs...

NAME
Set-VM

SYNOPSIS
Changes properties of a virtual machine managed by Virtual Machine Manager.

SYNTAX
Set-VM [-VM] [] -JobGroup [-BootOrder ]
[-CostCenter ] [-CPUCount ] [-CPUMax ]
[-CPUReserve ] [-CPUType ] [-Custom1 ]
[-Custom10 ] [-Custom2 ] [-Custom3 ] [-Custom4 ]
[-Custom5 ] [-Custom6 ] [-Custom7 ] [-Custom8 ]
[-Custom9 ] [-DelayStart ] [-Description ]
[-DiskIO ] [-EnableBackup ] [-Enabled ]
[-EnableDataExchange ] [-EnableHeartbeat ]
[-EnableOperatingSystemShutdown ]
[-EnableTimeSynchronization ]
[-ExcludeFromPRO ] [-ExpectedCPUUtilization ]
[-HighlyAvailable ] [-InstallVirtualizationGuestServices]
[-JobVariable ] [-LimitCPUForMigration ]
[-LimitCPUFunctionality ] [-MemoryMB ] [-Name ]
[-NetworkUtilization ] [-NumLock] [-OperatingSystem ]
[-Owner ] [-PROTipID ] [-QuotaPoint ]
[-RelativeWeight ] [-RemoveSelfServiceUserRole ] [-RunAsSystem]
[-RunAsUserCredential ] [-RunAsynchronously ]
[-StartAction ] [-StopAction ] [-Tag ]
[-UseHardwareAssistedVirtualization ] [-UserRole ]
[-VMwareResourcePool ] []

DESCRIPTION
Changes one or more properties of a virtual machine managed by Virtual Machine
Manager. Properties that you can change include:
* Name, owner, and description of a VM.
* BIOS boot order (for VMs on a Hyper-V host)
* Amount of resources on the host used by a VM. These include:
- Maximum amount of host CPU resources that a VM can use.
- Minimum amount of host CPU resources that a VM can use.
- Expected use of host CPU by a VM.
- Amount of host CPU resources used by one VM relative to
other VMs on the same host.
- Amount of host memory that a VM can use.
- Amount of bandwidth on the host's network that a VM can use.
* Hardware settings for a VM unrelated to host resources. These include:
- Number of CPUs
- Type of CPU
- Number of disk input/output operations per second (IOPS)
- Limiting CPU functionality (for an older operating system,
such as Windows NT 4.0)
* Cost center, tag, and custom settings used to filter VMs by criteria
that you set.
* Settings that enable various optional capabilities, including:
- Enabling or disabling a library object to make it available,
or temporarily unavailable, to users
- Enabling backing up a VM on a Hyper-V host with Volume Shadow Copy
- Enabling a key/value pair for data exchange between a VM and its
Hyper-V host
- Enabling a signal to monitor a VM on a Hyper-V host.
- Enabling shutdown of a VM from teh Hyper-V console.
- Enabling time synchronization between a VM and its Hyper-V host.
- Enabling the BIOS value for NumLock for a VM on a Windows host.
* Setting that identifies whether a VM is highly available, that is,
a VM to be deployed on a node of a Hyper-V host cluster.
* Setting that determines whether virtualization guest services are
installed on a Windows-based VM.
* Number of seconds to delay before starting a VM.
* Setting that identifies the operating system used for a VM.
* Settings that specify whether to run a VM on a Virtual Server host under
the local system account or under a guest account (domain\account).
* Start and stop actions for a VM.
* Setting that determines whether a VM on a Virtual Server host uses
hardware-assisted virtualization.
* Setting that limits the number of VMs self-service users can create.
* Setting used to switch the role that a self-service user who belongs
to multiple roles uses to manage a VM.
* Setting that assigns a VM on an ESX host to a VMware resource pool.

If you want to change the properties of a virtual floppy drive, virtual DVD
drive, virtual network adapter, or virtual SCSI adapter associated with a
specific virtual machine, you can use Set-VirtualFloppyDrive,
Set-VirtualDVDDrive, Set-VirtualNetworkAdapter, or Set-VirtualSCSIAdapter,
respectively.

For more information about virtual machines, type:
Get-Help New-VM -detailed

RELATED LINKS

DisableUndoDisk-VM
DiscardSavedState-VM
Move-VM
New-VM
Refresh-VM
Remove-VM
Repair-VM
Resume-VM
SaveState-VM
Shutdown-VM
Start-VM
Stop-VM
Store-VM
Suspend-VM

REMARKS
To see the examples, type: "get-help Set-VM -examples".
For more information, type: "get-help Set-VM -detailed".
For technical information, type: "get-help Set-VM -full".

Re-motivated...

It has been a very long time, too long in fact, since I have made the time to do some blogging...


I have decided that this is very lax of me and this must change...


To that end I have taken steps to get a decent test environment up and running so that I can try out the growing portfolio of virtualisation products and tools. With VMware, Microsoft and Citrix now all providing numerous virtualisation products, from Type 1 and Type 2 hypervisors, VDI solutions and application virtualisation there is plenty to keep me interested. I have decided to start the new posts with the Microsoft Virtualisation product line.


The test server I decided to use is a HP Microserver, this fit my goals:




  • Reasonable specs to run enough virtual machines (Dual Core AMD processor & maxed out to 8GB of RAM)

  • Internal Storage - the plan is to get shared storage later on, but for now local storage met my cost requirements

  • Talking of cost requirements, I wanted the server to not impact my bank balance too much

I have been very impressed with the server so far. It is very quiet, Microsoft Windows 2008 R2 installed with no issues at all and I have VMs up and running in a very short time frame.

So now I have my environment up and running more posts will follow :)