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!

Vembu BDR Suite v4.0 Generally Available (GA)

This week Vembu BDR Suite v4.0 became Generally Available (GA). With a lot of new features, customer requests and performance enhancements, it’s a realy nice product to backup your workloads.

My attention goes sepcially to Hyper-V backup, because I’m a real Microsoft geek!!

Here’s a overview of some enhancements:

  • Hyper-V Failover CLuster Support;
  • Checksum Based Incremental Tracking;
  • Shared VHDX support for Hyper-V;
  • Credential Manager;
  • Improvements to the User Interface (UI);
  • Reconnection for VMware and Hyper-V jobs;
  • New Disk Addition for VMware and Hyper-V;
  • Live Recovery to VMware;
  • Live Recovery to Hyper-V;
  • Quick VM Recovery Report;
  • API for VM list with Storage utilization report;

Some major features in the new Vembu BDR Suite:

  • Agentless Microsoft Hyper-V Backup with CBT Incrementals;
  • Disk Image Backup for WIndows Servers and Workstations;
  • Native Tape Storage support;
  • File & Application Backup for Windows, Linux and Mac;
  • Bare Metal Recovery;
  • Vembu Universal Explorer;
  • Failover and Failback;
  • Free Edition support;

This is only just a bunch of new features and major features in the new Vembu BDR Suite v4.0. Check the release notes here.

Personally I’m realy happy with the Hyper-V Failover Cluster Support!! In my daily job I’m designing and building a lot of Hyper-V environments, inclusing huge and complex clusters.

The whole team from Vembu did a realy great job with the new release of Vembu BDR Suite v4.0. Great enhancements, great new features and realy easy to use! With the new features, new major features, enhancements and support for cluster environments, Vembu BDR Suite v4.0 is a very powerful solution for backup and disaster recovery.

Below some handy URL’s. Check it out and try Vembu BDR Suite v4.0 yourself!!

Note:

Vembu BDR Suite v4.0 is available only for fresh installation. Soon it will also be available for existing environments to upgrade from older versions.

 

 

 

 

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: Enable RDP during Task Sequence with SCCM 2012 R2

I quiet often receive the question how to enable Remote Desktop (RDP) access on a server during a task sequence in SCCM 2012 or 2012 R2. Because by default RDP is not enabled, it could be realy handy to enable RDP access to control your server remotely. There’re a whole bunch of tools to manage your server(s) remotely, but still RDP could be ncessary.

1.) Create a new package with the source location to your script directory.
2.) Create a new package with a program and use the following command:
Powershell.exe -ExecutionPolicy Unrestricted -NoProfile -File Enable-RDP.ps1
3.) The PowerShell script ‘Enable-RDP.ps1’ contains the following code. See in this post below.
4.) Insert the script in your task sequence

##
## Enable RDP
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server' -name "fDenyTSConnections" -Value 0
##
## Enable Firewall Rule
Enable-NetFirewallRule -DisplayGroup "Remote Desktop"
##
## Enable RDP Authentication
Set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 0

2015-11-27_09h03_02    2015-11-27_09h03_21    2015-11-27_09h34_03

How to: Change the view of Mozille Firefox options menu

Today I’ve upgraded Mozilla Firefox from version 35.0.1 to 38.0.5. After the succesfully upgrade, everythin looks fine. But there’s one crucial thing that has been changed in version 38.x. The “Options” menu is not a pane anymore, but it will be open in a new tab. I’ve customized some things in the browser (hide the network button) in the UserChrome.css file. In the new Options tab, the netwerk button is available again for my users. So, I want to hide this option and it works great in version 35.x.

With a simple edit in the UserPref.js file within the profile of my users, I can force the “Options” menu view in the ‘old’ way. After that, the network button is gone again!! 🙂

I’ve used RES Workspace Manager 2014 for distribution the new UserPref.js file to all of my users, but you can also use some other 3th party software or do it just manually.

1.) Open Mozilla Firefox 38.x
2.) Type about:config
3.) Search for “browser.preferences.inc
4.) Set the option “Browser.preferences.inContent” from true to false
5.) Close Mozilla Firefox and open it again

Options_01    Options_02    Options_03

Options_04    Options_05    Options_06

How to: Disable network selection OOBE during a task sequence in ConfigMgr 2012 R2

During a deployment of Microsoft Windows 8/8.1, you’ll receive a question to select a prefered network connection. This is also happening during a task sequence within Microsoft SCCM 2012 R2. It’s easy to disable this
question during the task sequence, using an unattend XML file.

1.) First open the “Windows System Image Manager”, also known as WSIM
2.) Select the image you want to deploy. In my example “Install.WIM” from the Windows 8.1 source files
3.) Create a new catalog for this image
4.) After the catalog has succesfully created, create a “New Answer File”
5.) Navigate to the following selection
amd64_Microsoft-Windows-Shell-Setup_6.3.9600.17031_neutral
6.) Select the “+” on the left side and naviagte to “OOBE”
7.) Right-click on “OOBE” and select “Add Settings to Pass7oobeSystem
8.) Select in the right pane OOBE
9.) Select in the properties pane “HideWirelessSetupInOOBE” and set the value to “True”
10.) Save the XML file on your “source” directory on your primary site server
11.) Create a new package with the source directory to the directory you’ve created in the stap before
12.) Do NOT create any program in the package, so select “Do not create a program”
13.) Distribute the new package to your distribution point(s)
14.) Open your task sequence and navigate to stap “Apply Operating System”
15.) Select the option “Use an unattended or Sysprep answer file for a custom installation
16.) Select the package you’ve created before and type the name of your XML file within that package source location
17.) Boot a client from the network (PXE) and select the task sequence.

If you follow the steps within the task sequence, you’ll see that you didn’t receive a network connection screen anymore.

2015-03-16_10h34_12    2015-03-16_10h35_34    2015-03-16_10h49_24

2015-03-16_10h56_31    2015-03-16_10h57_29    2015-03-16_10h57_36

2015-03-16_10h57_54    2015-03-16_10h58_08    2015-03-16_10h58_22

2015-03-16_10h58_34    2015-03-16_10h59_21    2015-03-16_11h01_38

2015-03-16_11h02_14    2015-03-16_11h03_12    2015-03-16_11h03_45

Can’t start Sticky Notes in Windows 8.1 with RES Workspace Manager 2014

Last week I’ve been working on a big VDI environment with RES Workspace Manager 2014, Windows 8 and VMWare Horizon View. Everything looks realy nice and is working realy well!! But I’ve seen one strange thing. One of the applications “Sticky Notes” couldn’t be started from the start menu or Windows tiles. In this blogpost you’ll find a solution for this problem.

1.) Add Sticky Notes to RES Workspace Manager 2014
2.) Open the Properties of the new application and navigate to the second tab “Settings
3.) Scroll down to “Disable file system redirector on 64-bit systems” and Enable this setting
4.) Refresh the User Workspace and start the application again
5.) Sticky Notes can now be used

2014-10-01_09h43_05    2014-10-01_09h44_20    2014-10-01_09h44_27

2014-10-01_09h44_43    2014-10-01_09h44_56    2014-10-01_09h49_04

How to: Set Microsoft Office initials with Active Directory information using RES Workspace Manager 2014

When you’ve installed Microsoft Office in your environment, the first time the user starts one of the Office products, they receive a pop-up box for the initials. Default there are two things the user has to fill in. The username and the initials. The username is the displayname within Active Directory. The initials is the first letter of the username. But, what if you want to fill this field also with some Active Directory information, like the property Initials.

In this environment I’m using RES Workspace Manager 2014, so there’re also possibilities to set some user variables in your session. First I’ve created a new environment variable with a query to read the information from Active Directory.

1.) Open the RES Workspace Manager Console and create a new environment variable. In my example it is Initials
2.) Give the new variable the following value $adinfo(Initials) There’re some more values possible, like firstname, lastname, etc….
3.) Login to your session, in my example a Windows 8.1 VDI desktop and open the command prompt
4.) Type the command set and search for the new variable Initials. It’s the information from the Active Directory
5.) Now return to the RES Workspace Manager Console and create a new User Setting (User Registry)
6.) The values are stored in the following registrykey:
HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Userinfo
7.) Add this path in the new registry setting and create two new REG_SZ keys
UserInitials with the value %Initials%
Username
with the value %Username%
8.) Configure the Access Control and the Workspace Container
9.) Login again into a new session and start Microsoft Office, for example Word, Excel, Outlook, PowerPoint, etc…
10.) Open the options and take a look at the user initials.

This is a realy powerfull solution to control your users initials. You can choose to apply the User Registry settings once, so the users are able to edit the initials. You can use a User Preference to store this information in a .UPR (User Preference) with RES Workspace Manager.

2014-08-12_15h40_07    2014-08-12_15h40_16    2014-08-12_15h40_47

2014-08-12_15h41_41    2014-08-12_15h43_17    2014-08-12_15h45_09

2014-08-12_15h45_25