The snippet of code above will perform a SCSI UNMAP (old name) or VMFS UNMAP (new name) on a particular datastore. This is a task that should be scheduled and run multiple times per datastore to see any real benefit.

Some things to note:

$Size is how big of a block to work with – This is usually 200, 400, 800 or 1600. The bigger the block size, the more IOPS will be committed to the process. Be careful when using in a production environment and be sure to test!

$BeforeUsed is simply the amount of space the SAN says is in use before the VMFS UnMap command is run.

$AfterUsed is simply the amount of space the SAN says is in use after the command completes.

$lun and $vol are CASE Sensitive!

If there is any interest, I’ll add a new post with some samples of how to use this process in a scheduled task.

Rate this:

I was playing around with some Powershell scripts over the weekend and came across a very interesting object:

SAPI.SPVoice

This object lets you generate speech from text and is very easy to use. I’ve included a few samples here to show just how easy!

In this example, we call our simple function with the text we want to hear. We also have an optional switch parameter called -SLOW that will change the speed of the speech, just for fun. This example is using a ComObject to generate the speech.

In the next example, we will use .NET to create the speech. We again call our function with the text we want to hear. By default, we have the speech running as a synchronous command.

(This simpy means that the speech will have to finish before moving on to the next command.)

We added another optional switch parameter for this one, however, if you want the command to run asynchronously instead (-ASYNC).

NOTE: When using the -ASYNC parameter, if you have multiple speech statements right after each other, the speech will be ‘clobbered’, as if two or more people were trying to speak at exactly the same time.

You can even read in a text file and have it converted to speech for you as well! Here is a quick example of how to do it:

#
# First we just create the ComObject
$voice = new-object -ComObject "SAPI.SPVoice"
# Then we use the new object to speak! This command is spoken synchronously.
$voice.speak("Powershell rocks!")
# And this minor change reads in and speaks a text file asynchronously.
$voice.Speak( "h:\scripts\callme.bat", 5 )
start-sleep 20
#
#

So there you have it! Text to Speech via Powershell is quick and easy!

— PFM

Rate this:

One of the laptops that I regularly use is a MacBook Pro. It runs the latest and greatest OS X version along with BootCamp and Windows 7. For those of you unfamiliar with BootCamp, it basically just allows you to dual-boot your Mac laptop and switch between OS X or Windows.

Since Windows 8 has been officially released, I decided to rebuild my MacBook Pro from scratch and use BootCamp to install Windows 8. If I liked it, I would keep it. If not, I would redo BootCamp and put Windows 7 back in place.

However, since the previous install of Windows 7 was a digital download and I seem to have misplaced my email receipt that contained my Windows Product Key, if I decided to switch back to Windows 7, I would not be able to activate it without some difficulties.

I did some searching online for a tool to identify your current product key and found Magical Jelly Bean. It’s an app that you install in Windows and it reveals your key. Pretty simple.

But what if you don’t have access to the internet or you simply don’t want to install an unknown app just to get your key?