Posts
Using clusterssh to admin multiple service consoles
We have our service consoles set up to disallow root logins and use sudo (with password) for access. Every once in a while this causes us some pain. How do you update file /etc/filex or run some command across a cluster or a bunch hosts when root privileges are needed?
There are multiple ways to approach this type of issue, but one I have not seen much of in the VMware blogosphere is clusterssh.
Posts
Using ScriptProperty members in PowerShell
I was looking for information on ScriptProperty members in PowerShell and was running into trouble finding anything useful. The PowerShell in Action book saved me on page 229.
Here is the object I am using in a piece of code that I am finishing for persisting server credentials to disk in a secure fashion. It shows a real world example of when a ScriptProperty is needed instead of the simpler NoteProperty.
Posts
VI SDK – Beware cached data and assumptions
Applications often cache data and that is good because that generally makes them perform better for users. However, if you make assumptions that what you see is the absolute truth you can run into trouble.
1 2 3 4 5 6 7 8 9 Connect-ViServer myVirtualCenter001 # Let's check the status of the server to make sure I can go home. (Get-vmhost myVmHost001.local | Get-View).OverallStatus green #Looks good. Well, maybe not.
Posts
Validating VM advanced settings
Now that we have covered how to make advanced settings changes we need to validate that the settings have been applied. Assuming that a script or command worked is never as good as checking it. Below is a script to do just that.
The script lists all statuses so if you only want to see issues you can pipe the output into the Where-Object cmdlet like so:
<vmObject(s)> | .\Validate-VmAdvancedSettings.ps1 | Where-Object {$_.
Posts
Making advanced settings changes to a running VM
If you use a method like that in the Powershell script I posted the changes can be made to a running VM. This is great because that dialog box is disabled in Virtual Center when the vm is up.
The settings do not take effect until the VM is power cycled (not just restarted in the OS). This is not that big of a deal on clusters with VMotion licensed because a VMotion starts a new instance of the VM on the destination host.
Posts
Version Control for (VMware) System Administrators
It has been long held that *nix administrators should use version control, but this knowledge has not really made it over to the Windows world where a lot of VMware administrators come from.
I consider version control for scripts and configuration files to be an essential part of any well run site. It is something that can be set up in a few hours (Window or *nix) and most admins will need to learn only the basics of the tools.
Posts
VMware Update Manager Profile Updates
I added these to my Powershell profile to make working with the VMware Update Manager Toolkit a little easier from my standard shell.
Add-PSSnapin VMware.VumAutomation function Get-VumCommand {Get-Command -pssnapin VMware.VumAutomation}
Posts
Get-AllRolePrivileges
This is a good script to easily report on privileges and can easily be extended to audit against a known good list of expected roles/privileges.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 # Must already be connected to a viserver. This works on the default vi server. $si = Get-View ServiceInstance $am = Get-View ($si.Content.AuthorizationManager) $roles = $am.RoleList foreach ($role in $roles) { foreach ($privilege in $role.
Posts
Script for VM advanced settings
I created this one so I could easily apply multiple advanced settings to a list of VMs. The $advancedSettings array is easily modified to change what get configured.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 # Usage: <vmobject> | .\Configure-VmAdvancedSettings.ps1 # Examples: Get-VM myTestVM | .
Posts
Script to update tools in templates.
Here is a script that takes template objects and updates their VMware tools.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 # Usage: <template object(s)> | .\Upgrade-ToolsTemplate.ps1 # Example: Get-Template template1 | .\Upgrade-ToolsTemplate.ps1 # Get-Datacenter corporate | Get-Template | .
Posts
A New VMware Scripting Site
A co-worker has created a site that is dedicated to scripting the VMware environment. It is a good place to share scripts, ask questions, and to have discussions about all types of VMware automation.
http://www.vmwarescripting.com
The site is relatively new so share what you can and keep coming back for new content.
Posts
Added VMware Logforwarder to the Scripts/Programs Page
I have updated my Scripts/Programs page to include the bundle of scripts that I created when testing out forwarding options for logs that are not normally accessible via the service console syslog subsystem.
This set of scripts is functional, but ended at POC stage when I decided to go another route. If there are any questions about them let me know, but they should not be used for production systems until more error checking added and testing is done.