Using Sysprep Instead of QuickPrep with VMware View Desktop Pools

Sometimes you need Sysprep instead of QuickPrep when creating a VMware View linked-clone desktop pool, usually because legacy software requires a unique local security identifier (SID) on every desktop. I was recently asked about it because an older antivirus product needed unique SIDs to centrally manage its in-OS agents.

The two customization methods are compared in the View Administration Guide (pages 95–96), and VMware KB 2003797 sums up the differences:

QuickPrep vs. Sysprep

FunctionQuickPrepSysprep
Removing local accountsNoYes
Changing Security Identifiers (SID)NoYes
Removing parent from domainNoYes
Changing computer nameYesYes
Joining the new instance to the domainYesYes
Generating new SIDNoYes
Language, regional settings, date, and time customizationNoYes
Number of reboots01 (seal & mini-setup)
Requires configuration file and SysprepNoYes

High-Level Steps

  1. Copy the Sysprep files to the vCenter Server. This is only needed for Windows XP; Windows 7 includes Sysprep. Details are in VMware KB 1005593.
  2. Create a guest customization specification in vCenter.
  3. Add a desktop pool that uses Sysprep with that customization specification.

Create a Guest Customization Specification

In vCenter, open Home → Customization Specification Manager, click New, and enter a name on the Properties page. Do not use a custom Sysprep answer file.

Customization specification Properties page in vCenter

Continue to the Computer Name page and set it to use the virtual machine name. Then enter your license key, administrator password, time zone, and so on until you reach the Network page.

Leave the network at the default Typical settings so the desktops use DHCP.

Network page set to typical settings (DHCP)

Leave the Workgroup or Domain page at its default. Anything entered here is ignored; the VM joins the domain using the guest customization settings in the View pool instead.

Workgroup or Domain page left at default

On the final Operating System Options page, make sure Generate New Security ID (SID) is checked. Unique SIDs are the whole reason we’re using Sysprep. Then finish the wizard.

Generate New Security ID (SID) option checked

Add the Desktop Pool

In View Manager, add a desktop pool as usual. The only difference from QuickPrep is on the final Guest Customization page:

  • Select the Domain. This list (usually just one entry) comes from the domains you defined for View Composer when you configured vCenter in View Administrator. It controls which domain the linked clones join and which credentials are used.
  • Select the Active Directory container as normal.
  • Choose Use a customization specification (Sysprep) and select the spec you created.
View pool Guest Customization page using a Sysprep customization specification

Finish the wizard and the pool will deploy. Provisioning is a bit slower than with QuickPrep because each linked clone needs an extra reboot.

What Happens When View Customizes with Sysprep

  1. Once the linked clone disks are created, View Manager puts the VM into the Customizing state.
  2. View Manager calls the vCenter API customizeVM_Task to apply the customization specification.
  3. View Manager powers on the linked clone.
  4. Inside the guest, the View Composer Agent sees it’s starting for the first time and calls NetJoinDomain with the machine password cached on the internal disk.
  5. The machine is now joined to the domain.
  6. Sysprep runs inside the guest.
  7. The View Composer Agent waits for Sysprep to finish, then tells the View Agent customization is complete, and the View Agent notifies the View Manager server.
  8. View Manager powers off the clone and snapshots it in its customized state, which becomes the refresh point.
  9. View Manager marks the linked clone Provisioned. When powered on, it moves to Available.

How to Update Dell Force10 S50N Switch Firmware (FTOS) via TFTP

Updating the FTOS firmware on a Dell Force10 S50N switch takes one command and a TFTP server. You can connect over the serial console or SSH.

Firmware download: FTOS-SB-8.4.2.7.bin

Steps

  1. Install a TFTP server on your desktop and copy the firmware file into its folder.
  2. Connect to the switch (serial or SSH) and run the upgrade, pointing at your TFTP server’s IP:
Force10#upgrade system tftp://192.168.1.xxx/FTOS-SB-8.4.2.7.bin
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Erasing Sseries ImageUpgrade Table of Contents, please wait
.................................................................!
17234435 bytes successfully copied
Force10#
  1. Save the configuration with write before you issue reload.

Example Running Config (Two-Unit S50N Stack)

For reference, here’s my running config for a two-switch S50N stack serving VMware hosts and an EqualLogic iSCSI SAN. Repeated interface blocks are trimmed; each port type is shown once.

force10#show running-config
Current Configuration ...
! Version 8.4.2.7
!
redundancy auto-synchronize full
!
hardware watchdog
!
hostname force10phx
!
enable password 7
!
username root password 7 privilege 15
username admin password 7 privilege 15
!
ethernet cfm
!
protocol spanning-tree rstp
no disable
!
stack-unit 0 provision S50N
!
! vHost data ports (0/1-0/6, 1/1-1/6)
interface GigabitEthernet 0/1
description vHost IP 07-01
no ip address
mtu 9252
no shutdown
!
! vHost iSCSI ports (0/7-0/12, 1/7-1/12)
interface GigabitEthernet 0/7
description vHost iSCSI 07-01
no ip address
mtu 9252
switchport
flowcontrol rx on tx on
spanning-tree rstp edge-port
no shutdown
!
! EqualLogic iSCSI ports (0/13-0/20, 1/13-1/20)
interface GigabitEthernet 0/13
description EQL iSCSI Port
no ip address
mtu 9252
switchport
flowcontrol rx on tx on
spanning-tree rstp edge-port
no shutdown
!
interface GigabitEthernet 0/43
description Config Port
no ip address
mtu 1500
switchport
no shutdown
!
interface GigabitEthernet 0/46
description DMZ UpLink 01
no ip address
switchport
no shutdown
!
! Unused ports
interface GigabitEthernet 0/21
no ip address
shutdown
!
stack-unit 1 provision S50N
! (unit 1 mirrors unit 0; DMZ UpLink 02 on 1/46)
!
interface Port-channel 1
description vHost 7 IP
no ip address
mtu 9252
switchport
switchport mode private-vlan trunk
no spanning-tree
channel-member GigabitEthernet 0/1-2
channel-member GigabitEthernet 1/1-2
no shutdown
!
! Port-channel 2 (vHost 8: 0/3-4, 1/3-4) and 3 (vHost 9: 0/5-6, 1/5-6) are identical
!
interface Vlan 28
description PHX Production
name PHX Production
no ip address
tagged Port-channel 1-3
no shutdown
!
interface Vlan 29
description PHX Operations
name PHX Operations
ip address 192.168.29.175/24
tagged Port-channel 1-3
untagged GigabitEthernet 0/22,43
untagged GigabitEthernet 1/22,39,42
no shutdown
!
interface Vlan 30
description PHX Development
name PHX Development
no ip address
tagged Port-channel 1-3
no shutdown
!
interface Vlan 369
description DMZ
name DMZ
no ip address
tagged Port-channel 1-3
untagged GigabitEthernet 0/46
untagged GigabitEthernet 1/41,46
no shutdown
!
interface Vlan 387
description Development
name Development
no ip address
tagged Port-channel 1-3
no shutdown
!
interface Vlan 732
description PHX DB
name PHX DB
no ip address
tagged Port-channel 1-3
no shutdown
!
interface Vlan 999
description iSCSI LAN
name iSCSI LAN
no ip address
mtu 9252
tagged GigabitEthernet 0/7-12
tagged GigabitEthernet 1/7-12
untagged GigabitEthernet 0/13-20
untagged GigabitEthernet 1/13-20
no shutdown
!
ip route 0.0.0.0/0 Vlan 29 192.168.x
!
ip name-server 192.168.x
!
logging history debugging
logging trap debugging
logging source-interface Vlan 29
logging 192.168.x
!
snmp-server community public ro
snmp-server enable traps snmp authentication coldstart linkdown linkup
snmp-server enable traps stp
snmp-server enable traps xstp
snmp-server enable traps envmon fan supply temperature
snmp-server location xxxx
no ip telnet server enable
!
ntp server 192.168.x
!
ip ssh server enable
!
buffer-profile global 4Q
!
line console 0
line vty 0
! ... line vty 1-9
!
end

How to Recover a Windows Server 2003 Software RAID Mirror After Losing the Primary Drive

If you’ve lost the primary drive in a Windows Server 2003 software RAID mirror, on purpose or not, you can get the server booting again from the Recovery Console.

Steps

  1. Boot from the Windows Server 2003 installation disc.
  2. Press R to start the Recovery Console.
  3. Select your Windows installation and enter the Administrator password.
  4. Check the disk, then rebuild the boot configuration:
chkdsk /p
bootcfg /rebuild

Reboot, and Windows should start from the remaining mirror drive. You can then replace the failed disk and re-add the mirror in Disk Management.

How to Add a New Disk to LVM on CentOS (parted, pvcreate, vgcreate, lvcreate)

You can create an LVM physical volume directly on a raw block device, but I avoid it. It can cause confusion later about what the disk is used for, and it can break some of LVM’s auto-discovery if its configuration files are missing. Instead, I put a single LVM partition on each disk first.

1. Partition the Disk with parted

This creates a GPT label with one partition spanning the whole drive and sets the LVM flag. The 1M start offset ensures proper alignment. mkpart requires a filesystem type, but it doesn’t actually create a filesystem (a long-standing parted quirk).

parted /dev/sdb
mklabel GPT
mkpart primary ext2 1M 100%
set 1 lvm on
quit

2. Create the Physical Volume, Volume Group, and Logical Volume

pvcreate /dev/sdb1
pvdisplay
vgcreate vg_name /dev/sdb1 /dev/sdc1 /dev/sdd1
vgdisplay
lvcreate --extents 100%FREE -n lv_name vg_name
lvdisplay

The vgcreate example combines three prepared disks (sdb1, sdc1, sdd1) into one volume group. Replace vg_name and lv_name with your own names.

3. Create the Filesystem and Check It

mkfs.xfs -f /dev/mapper/vg_name-lv_name
df -ah

To grow an existing volume instead, see how to extend an LVM logical volume on CentOS.

Replace sysklogd with rsyslog on CentOS and Forward Logs to Splunk

Older CentOS servers use sysklogd, which can’t forward logs over TCP with a disk queue. Here’s how to swap it for rsyslog and send everything to Splunk.

1. Swap sysklogd for rsyslog

Use yum shell to remove and install in one transaction:

yum shell
remove sysklogd
install rsyslog
run
exit

2. Add the Splunk Forwarding Rule

Edit /etc/rsyslog.conf and paste in this block, replacing your-splunk-server with your Splunk host:

# ### begin forwarding rule ###
# The statement between the begin ... end define a SINGLE forwarding
# rule. They belong together, do NOT split them. If you create multiple
# forwarding rules, duplicate the whole block!
# Remote Logging (we use TCP for reliable delivery)
#
# An on-disk queue is created for this action. If the remote host is
# down, messages are spooled to disk and sent when it is up again.
$WorkDirectory /var/lib/rsyslog # where to place spool files
$ActionQueueFileName fwdRule1 # unique name prefix for spool files
$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible)
$ActionQueueSaveOnShutdown on # save messages to disk on shutdown
$ActionQueueType LinkedList # run asynchronously
$ActionResumeRetryCount -1 # infinite retries if host is down
# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional
*.* @@your-splunk-server:514
# ### end of the forwarding rule ###

3. Enable and Restart rsyslog

chkconfig rsyslog on
service rsyslog restart

See also forwarding CentOS syslog to Splunk with rsyslog.

Fix iSCSI Latency on Dell R815 with Broadcom NICs in VMware ESXi

Our new Dell PowerEdge R815 hosts had strange latency on iSCSI traffic running over Broadcom NICs on a dedicated, segregated storage LAN.

The Fix: Update the Broadcom NetXtreme II Driver

The solution was the updated Broadcom NetXtreme II driver bundle:

BCM-NetXtremeII-5.0-offline_bundle-940344.zip
  1. Import the offline bundle into VMware Update Manager.
  2. Attach it to the hosts in a baseline and remediate.
  3. Reboot each host.

After one reboot, the latency was gone and everyone was happy.

How to Add a Persistent Cron Job on a VMware ESX/ESXi Host

On VMware ESX/ESXi, changes to the root crontab are lost when the host reboots. Here’s how to add a cron job that survives reboots by re-creating it from /etc/rc.local.

Enable SSH on the host first, then log in as root.

1. Add the Job to the Root Crontab

  1. Edit /var/spool/cron/crontabs/root.
  2. Add your job on a single line, for example:
5 0 * * * /full/path/to/script arguments/with/full/path > /full/path/to/logfile 2>&1
  1. The file is read-only, so save and quit vi with Esc then :wq!.

5 0 * * * means 5 minutes past midnight every day. See the crontab(5) man page for the full schedule syntax.

2. Re-create the Job at Boot via /etc/rc.local

Edit /etc/rc.local (for example, vi /etc/rc.local) and add these three lines at the end. The first stops crond, the second appends your job to the root crontab, and the third starts crond again:

/bin/kill $(cat /var/run/crond.pid)
/bin/echo '5 0 * * * /full/path/to/script arguments/with/full/path > /full/path/to/logfile 2>&1' >> /var/spool/cron/crontabs/root
/bin/busybox crond

Save and exit, then run the command below so your /etc/rc.local change itself survives a reboot:

auto-backup.sh

Remember: every time you change the cron job, update /etc/rc.local too and run auto-backup.sh again.

After a P2V Conversion: Fix the Windows HAL and Clean Up Old Hardware in VMware

After converting a physical Windows server to a VMware virtual machine (P2V), there’s some cleanup to do, especially if you went from a multi-processor system to a single vCPU. Here’s my checklist.

1. Switch the HAL from Multi-Processor to Uni-Processor

If you change from a multi-processor to a uni-processor system, you have to change the Windows HAL manually after the conversion.

  1. Let the VM boot and discover its new hardware, then open Device Manager.
  2. Expand Computer, right-click the processor entry, and choose Update Driver.
  3. Choose Install from a specific location, then Don’t search. I will choose the driver to install.
  4. Select Show all compatible hardware and pick the right one. For example, going from dual CPU to single CPU, choose ACPI Uniprocessor PC instead of ACPI Multiprocessor PC.
  5. Reboot.

To check which HAL is in use, right-click C:\Windows\System32\hal.dll, open the Version tab, and look at Internal Name: halmacpi.dll means multi-processor ACPI and halacpi.dll means uni-processor ACPI.

2. Remove Non-Present (Ghost) Hardware

Open a Command Prompt and run:

SET DEVMGR_SHOW_NONPRESENT_DEVICES=1
DEVMGMT.MSC

In Device Manager, choose View → Show hidden devices and delete any old, grayed-out hardware.

3. Remove Vendor-Specific Software and Drivers

  • Uninstall hardware vendor tools in Add/Remove Programs. On an HP server, for example, remove the HP management agents, survey utility, array configuration utility, and version control agent.
  • Make sure the NIC isn’t using vendor-specific drivers or software, such as NIC teaming.
  • Review Services and disable anything tied to the old hardware vendor.

Enable Apache mod_rewrite (AllowOverride All) for WordPress Permalinks

If WordPress “post name” permalinks return 404 errors on an Apache server, Apache probably isn’t allowing the .htaccess rewrite rules WordPress depends on. The fix is a one-line change.

Steps

  1. Open the Apache configuration file at /etc/httpd/conf/httpd.conf.
  2. Find the Directory block for your DocumentRoot, normally <Directory "/var/www/html">.
  3. Change AllowOverride None to AllowOverride All.
  4. Restart Apache.
<Directory "/var/www/html">
    AllowOverride All
</Directory>
service httpd restart

This step is essential for WordPress post name permalinks to work.

How to Set Up MySQL and Apache for WordPress on CentOS

Before installing WordPress on a CentOS server, you need a web server, PHP, and a MySQL database with a dedicated user. Here’s the quick setup I use.

1. Install MySQL and Apache

yum install mysql
yum install mysql-server
chkconfig mysqld on
service mysqld start
sudo yum install php-gd
yum install httpd
chkconfig httpd on
service httpd start

2. Create the WordPress Database and User

Open the MySQL client and create a database, then grant a user full rights on it. Replace databasename, username, hostname, and password with your own values:

$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE DATABASE databasename;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON databasename.* TO "username"@"hostname"
    -> IDENTIFIED BY "password";
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.01 sec)

mysql> EXIT
Bye

Use these database details in wp-config.php when you install WordPress. For pretty permalinks, also enable mod_rewrite in Apache.