Search This Blog

Prevent PowerShell Out-File Truncating Output

When trying to list the full path of all files in a folder and its subfolders, the Out-File cmdlet truncats the path for files with the long path.

It turns out that Out-File outputs the data with the same width of the PowerShell console (see Using the Out-File Cmdlet).

To work around the issue, include the –width parameter and specify a different line width(e.g. –width 4096). This outputs every line with 4096 characters long (pedding with spaces).

To output line width to match the longest output, add Ft –autosize before Out-File. For example:

Get-ChildItem -File -Recurse -Path Z:\ | where {$_.LastWriteTime -gt "MM/DD/YYYY"} | select FullName | Ft -autosize | Out-File c:\temp\modified.file.txt -Width 4096

vSphere Memory Ballooning

I know nothing about memory ballooning until I read this post – “How does memory ballooing work”.

Here is my understanding of this topic:

What is memory ballooning?

The ballooning driver (part of VMware Tools) frees up the VM guest memory (active memory + free memory) and makes it available to the Hypervisor (so avoid hypervisor swapping).

How does it work? and how does it impact performance?

The ballooning driver will balloon all ram down to the minimum recommended memory for each operating system + Mem.AppBalloonMaxSlack (16 MB by default, it’s adjustabe from 1 MB – 256 MB). The minimum recommended memory value is set by the operating sytem vendor and hard coded by VMware. It cannot be changed.

For example, RHEL 7’s minimum recommended memory is 512 MB. The ballooning driver will balloon all ram down to 528 MB (512 + 16). If an application in the OS requests more than 528 MB memory, it causes the guest operating system to swap/page. This is better than hypervisor swapping, but still a really bad impact for performance.

 How to avoid Ballooning?

  • Avoid over provisiooning server memory (the best option)
  • Make a reservation for server memory (bad idea in most respects)
  • Do not install VMware Tools (bad idea in every respects)

VMware vRealize Production Test Tool

VMware KB2134520 documents the steps to use vRealize Production Test Tool to validate and test the vRealize Automation configuration and identify potential configuration failures, password expiration, certificate errors and more.

VSAN Storage Controller Cache

In “VSAN 6.0 Design and Sizing Guide” v.1.0.5, April 2015, under Storage controller cache considerations section, “VMware’s recommendation is to disable the cache on controller if possible. Virtual SAN is already caching data at the storage layer – there is no need to do this again at the controller layer. If this cannot be done due to restrictions on the staorge controller, the recommendation is to set the cache to 100% read.”.

However in “VSAN Ready Nodes”“VSAN Ready Nodes”, the storage controller in some configuration includes the cache. For example, the storage controller in the Dell PowerEdge R630.

VSAN.Dell.PER630.Controller

Why includes the controller cache when VMware recommends disabing it?

It turns out the controller cache allows the larger queue depth – see this.

In “VSAN 6.0 Design and Sizing Guide”, VMware recommends the minimum queue depth is 256, and choose a controller with a much larger queue depth when possible.

For more information about the queue depth, see the following

Simple Way to Convert Time to Hours in Excel

Here is a simple way to convert the time to hours in Excel.

Hours (in decimal) = Time (in hh: mm: ss) * 24
24 is the number of hours in one day

It’s handy to caculate the file transfer rate in Excel. In the screenshot below, format column E in Number, the formula in colume E3 is C3 * 24.

2015-12-30_13-12-21

Follow the simular concept, convert time to minutes in Excel

Minutes (in decimal) = Time (in hh: mm: ss) * 1440
1440 is the number of minutes in one day

Convert time to seconds in Excel

Seconds (in decimal) = Time (in hh: mm: ss) * 86400
86400 is the number of seconds in one day

Exclude Virtual Machine Hard Disk from Snapshot

A virtual machine hard disk in vSphere v.5 or v.6 can be configured in three different modes:

  • Dependent: the default disk mode. The disk is included in snapshot.
  • Independent – Persistent: Changes to the disk are immediately and permanently written to disk. The disk is not included in snapshot.
  • Independent – Nonpersistent: Changes to the disk are discarded when power off. The disk is included in snapshot.

To change a VM hard disk to Independent – Persistent mode in vSphere v.6 Web Client:

  • Power off the VM
  • Delete any snapshots that currently exist
  • Right-click the VM and click Edit Settings
  • Under Virtual Hardware tab, expand the hard disk
  • In Disk Mode, select Independent – Persistent
  • Click OK

VM.Harddisk.Mode

To verify a VM hard disk excluded from snapshot:

  • Take a snapshot of the VM
  • Right-click on the datastore storing the VM and click Browse Files
  • Browse to the VM folder
  • If the disk is not set to Independent – Persistent mode, a VM-00001.vmdk file is created for the disk
  • If the disk is set to Independent – Persistent mode, this file will not be created

How to Save Windows 10 Lockscreen Image

  1. Open Run dialog
  2. Browse to %localappdata%\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets
  3. Copy all the files to a temporary folder
  4. Rename all the files with the JPG extension by entering “ren *.* *.jpg” in command prompt

Update: 01/18/2016

An app, SpotBright, in Windows Store makes even easier to download these images.

Use WinSCP to Transfer Files in vCSA 6.7

This is a quick update on my previous post “ Use WinSCP to Transfer Files in vCSA 6.5 ”. When I try the same SFTP server setting in vCSA 6.7...