PowerCLI: An Aspiring Automator’s Guide

Getting into scripting can be daunting. It’s easier to just use existing scripts found online, but if you choose this route you’ll quickly run into limitations. If you take the time to learn how to create your scripts, trust me, you’ll never look back!

clip_image002

Automating vSphere is particularly useful for countless applications and the best way is through PowerCLI – a version of PowerShell developed specifically for VMware. Learn how to develop your own PowerCLI scripts with this free 100+ page eBook from Altaro, PowerCLI: The Aspiring Automator’s Guide.

Written by VMware vExpert Xavier Avrillier, this eBook presents a use-case approach to learning how to automate tasks in vSphere environments using PowerCLI. We start by covering the basics of installation, set up, and an overview of PowerCLI terms. From there we move into scripting logic and script building with step-by-step instructions of truly useful custom scripts, including how to retrieve data on vSphere objects; display VM performance metrics; how to build HTML reports and schedule them; the basics on building functions; and more!

Stop looking at scripts online in envy because you wish you could build your own scripts.

Get started on your path to automation greatness – Download the eBook now!

Enable Azure Accelerated Networking

Azure Accelerated Networking is a new option for Azure Infrastructure as a Service (IaaS) Virtual Machine (VM) on the NIC level providing several benefits by enabling single root I/O virtualization (SR-IOV) to a VM, greatly improving its networking performance. This high-performance path bypasses the host from the datapath, reducing latency, jitter, and CPU utilization, for use with the most demanding network workloads on supported VM types. You would typically use this feature with heavy workloads that need to send or receive data at high speed with reliable streaming and lower CPU utilization. It will enable speeds of up to 25Gbps per Virtual Machine. Best of all, it’s free!

accelerated-networking

How to Enable Accelerated Networking:

You can enable this feature during initial creation of the VM, on the networking tab, you will see “Enable Accelerated Networking”. If you are unable to enable, then it is not compatible on your chosen Azure VM size. If you need to enable this feature after VM creation you will require to do so through powershell as it is not yet supported in the portal. You can do this simply with the below commands after deallocating the Virtual Machine.


Login-AzureRmAccount
$nic = Get-AzureRmNetworkInterface -ResourceGroupName “YourResourceGroupName” -Name “YourNicName”
$nic.EnableAcceleratedNetworking = $true
$nic | Set-AzureRmNetworkInterface

Then proceed to start the Virtual Machine and Accelerated Networking will be enabled.

Demo movie: Storage Spaces Direct in Windows Server 2016

The following movie shows the power of Storage Spaces Direct in Windows Server 2016. From the local disks, to storage pools and cluster, all the layers are explained!! Very useful when you want to know exactly how Storage Spaces Direct (S2D) works.

Software Defined will be the feature! So prepare yourself….. 🙂

How to: Initialize, format and label disks during OSD Task Sequence in SCCM 2012 R2

During a task seuence in Microsoft SCCM 2012 R2, the operating system and applications are installed on the C: drive in most situations. But in some deployments, you definitely want to create more disks. For example, you want to create a D: and E: partition for storing some other data. Maybe for Microsoft SQL or Exchange installation, databases, logfiles or just some other data.

The following script will do all these steps for you during the task sequence. The script initialize, format, partition and label the disks for you….fully automated! 🙂

## Set CD-ROM from E: to X:
Set-WmiInstance -InputObject ( Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'E:'" ) -Arguments @{DriveLetter='X:'}

$disks = Get-Disk | measure
If($disks.Count -eq 2)
{
## Initialize all new disks
Initialize-Disk 1
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
}
elseif($disks.Count -eq 3)
{
## Initialize all new disks
Initialize-Disk 1
Initialize-Disk 2
## Format and rename disks
Get-Disk | where {$_.Number -eq "1"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Data -Confirm:$false
Get-Disk | where {$_.Number -eq "2"} | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel Backup -Confirm:$false
## Set drive letters (D: - Data, E: - Backup)
Get-Disk | where {$_.Number -eq "1"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter D
Get-Disk | where {$_.Number -eq "2"} | Get-Partition | where {$_.PartitionNumber -eq 2} | Set-Partition -NewDriveLetter E
}
else
{
exit
}
exit

The script first checks how many disks are attached to the server.
If there is only one disk attached, you’ll have only a C: drive available after the deployment.
If there are 2 disks attached, you’ll have a C: and D: drive avalailable after the deployment.
If there are 3 disks attached, you’ll have a C:, D: and E: drive available after the deployment.

The CD-ROM drive will alse changed from E: to X:.

2015-12-18_12h30_44    2015-12-18_12h32_27    2015-12-18_12h32_52

2015-12-18_12h34_31    2015-12-18_12h37_51    2015-12-18_12h41_05

2015-12-18_12h41_43

How to: Change computername in Windows Explorer on Windows Server 2012 R2

When you’re are using a lot of virtual machines or environments, it’s somethimes realy usefull to see in what environment or on what server you’re logged in. If created a really nice solution for my servers, basically Remote Desktop Services in different environments, that does exact my I need! I’ve changed the displayname in Windows Explorer to the value “user on server”, for example: “mark on prod-rds-01”.

You can set this new value with Group Policy Preferences or some other scripting.

1.) Create a new GPO in the Group Policy Management Console
2.) Navigate to “User Configuration / Preferences / Windows Settings / Registry
3.) Create a new registry item and browse to the following registry key:
HKCU/Software/Microsoft/Windows/CurrentVersion/Explorer/CLSID/{20D04FE0-3AEA-1069-A2D8-08002B30309D}
4.) Change the default REG_SZ value to “%username% on %computername%”
5.) Login to the specific server where you targeted the GPO and open Windows Explorer
6.) The name of your computer has changed to “username on computername”

2015-12-04_11h19_20    2015-12-04_11h20_16    2015-12-04_11h20_48

2015-12-04_11h21_11    2015-12-04_11h21_40    2015-12-04_11h37_48

WEBINAR: Scripting & Automation in Hyper-V without SCVMM

Webinar_Altaro

Save the date!!

the 10th of december there is a free webinar about automating tasks in your Hyper-V environment without the user of Microsoft System Center Virtual Machine Manager (SCVMM).

This is realy usefull for that customers who don’t have System Center within their environment! Automation and scripting some tasks can save you a lot of time and money!
MVP Thomas Maurer and Technical Evangelist Andrew Syrewicze will present this webinar!

webinar-Join-button-scripting-automation1