I was looking at some tweets, and noticed one from @ScriptingGuys about how to add voice to a PowerShell script. Here is the actual tweet: http://twitter.com/ScriptingGuys/statuses/9343448757
Here’s the syntax in an example:
(New-Object -ComObject sapi.spvoice).speak(“Greetings Professor Falken”)
(New-Object -ComObject sapi.spvoice).speak(“Shall we play a game”)
So I took one of my PowerShell scripts, and modified it. I chose my PowerCLI: NFS Settings for vSphere (NetApp NFS Recommendations) script, because it is a short script, and it was easy to update.
#*************************************************************************** # # Update TCP and NFS Advanced Configuration Settings for vSphere w/Voice # Author: Jase McCarty # Date: 2/19/2010 # #*************************************************************************** <span style="color: #0000ff;">(New-Object -ComObject sapi.spvoice).speak("What is the ESX Host Name or IP Address")</span> $ESXHOST = Read-Host “Enter ESX Host Name or IP” Connect-VIServer $ESXHOST <span style="color: #0000ff;"> (New-Object -ComObject sapi.spvoice).speak("Now updating TCP and NFS Advanced Configuration Settings on host " + $ESXHOST)</span> Write-Host “Updating TCP and NFS Advanced Configuration Settings on host ” + $ESXHOST # Update TCP Settings Set-VMHostAdvancedConfiguration -VMHost $ESXHOST -Name Net.TcpipHeapSize -Value 30 Set-VMHostAdvancedConfiguration -VMHost $ESXHOST -Name Net.TcpipHeapMax -Value 120 # Update NFS Settings (For ESX 3.5, MaxVolumes should be 32) Set-VMHostAdvancedConfiguration -VMHost $ESXHOST -Name NFS.MaxVolumes -Value 64 Set-VMHostAdvancedConfiguration -VMHost $ESXHOST -Name NFS.HeartbeatMaxFailures -Value 10 Set-VMHostAdvancedConfiguration -VMHost $ESXHOST -Name NFS.HeartbeatFrequency -Value 12 Set-VMHostAdvancedConfiguration -VMHost $ESXHOST -Name NFS.HeartbeatTimeout -Value 5 (New-Object -ComObject sapi.spvoice).speak("NetApp Settings Complete")
Pretty cool addition. A good use of this, (as well as text prompts) would be when running commands against vCenter, “vocally” indicating changes to objects (hosts, clusters, guests, etc) as they are being modified.
This might be a little much, but when running a script against many objects, it would not require having to watch the screen for output while the script is running. Attention could then be focused on other things.
I don’t know if anyone is going to use this little addition, as it does take extra code. Administrators who approach scripts like I do (with many status messages and the like) might find this as a cool addition.
Figured I’d share.
Or you could use the much loved (hmm) office agents:
http://bartdesmet.net/blogs/bart/archive/2006/12/02/PowerShell-_2D00_-Ask-Merlin_3A00_-a-cool-demo-of-using-COM-objects.aspx
Jase,
When I clone VM’s the IP aliases attached to the NIC in Windows Server 03 advanced networking settings get deleted; thus forcing me to enter them in by hand every time which is annoying and time consuming. This is a fault of Sysprep it seems.
Any idea on how to write a script that will punch in the IPs based on hostname?
@Nick
Technically, you could use the method in this post: Update VMware Windows Guest DNS and WINS through PowerCLI. You would just have to modify the script to use netsh to update IP settings.