Patching the vCenter 6.x Appliance

With the latest version of the vCenter Appliance (vCSA) there is a new process to patching the appliance. Gone is the old Web UI of the 5.x era. The new process isn’t anything to be scared about though and should be familiar to most Admins and techs. Instead of the old web interface the upgrade process is basically just to attach the patch ISO and run a few commands via the console or SSH.

While researching the proces to update my own server however I came across a few unclear instructions concerning the process. I worked out what I needed to do after a few searches and a couple KB’s. Most of this guide will be a rehash of others and the official instructions but I will be including a few clarifications as well as some visual representations of the process to help those that got a little confused by the regular instructions.

Read more of this post

Weekend Project: Process Explorer Auto Install

I was bored this weekend and decided to try my hand at making a PowerShell script to automate the install of Sysinternals Process Explorer. It’s pretty rough product of about 3 hours of work. I’ll make improvements in the future as I get time. In any case, it’s available below.

#### Downloads Process explorer from download.sysinternals.com,
#### unzips it into Program Files and then cleans up.
####
#### Sources:
####	s1: http://nyquist212.wordpress.com/2013/09/23/powershell-webclient-example/
####	s2: http://sharepoint.smayes.com/2012/07/extracting-zip-files-using-powershell/

#Checks for Administrator privileges and opens an elevated prompt is user has Administrator rights
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
{   
    $arguments = "& '" + $myinvocation.mycommand.definition + "'"
    Start-Process powershell -Verb runAs -ArgumentList $arguments
    Break
}

# s1 
Function Get-Webclient ($urla, $out) {
    $proxy = [System.Net.WebRequest]::GetSystemWebProxy()
    $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials
    $request = New-Object System.Net.WebClient
    $request.UseDefaultCredentials = $true ## Proxy credentials only
    $request.Proxy.Credentials = $request.Credentials
    $request.DownloadFile($urla, $out)
}

# s2 

# Expands the entire contents of a zip file to a folder
# MSDN References
# - Shell Object:   http://msdn.microsoft.com/en-us/library/windows/desktop/bb774094(v=vs.85).aspx
# - SHFILEOPSTRUCT: http://msdn.microsoft.com/en-us/library/windows/desktop/bb759795(v=vs.85).aspx
function Expand-Zip (
    [ValidateNotNullOrEmpty()][string]$ZipFilePath,
    [ValidateNotNullOrEmpty()][string]$DestinationFolderPath,
    [switch]$HideProgressDialog,
    [switch]$OverwriteExistingFiles
    ) {
    # Ensure that the zip file exists, the destination path is a folder, and the destination folder
    # exists. The code to expand the zip file will *only* execute if the three conditions above are
    # true.
    if ((Test-Path $ZipFilePath) -and (Test-Path $DestinationFolderPath) -and ((Get-Item $DestinationFolderPath).PSIsContainer)) {
        try {
            # Configure the flags for the copy operation based on the switches passed to this
            # function. The flags for the CopyHere method are based on the SHFILEOPSTRUCT
            # structure's fFlags field. Two of the flags are leveraged by this function.
            # 0x04 --- Do not display a progress dialog box.
            # 0x10 --- Click "Yes to All" in any dialog box displayed. Functionally overwrites any
            #          existing files.
            $copyFlags = 0x00
            if ($HideProgressDialog) {
                $copyFlags += 0x04
            }
            if ($OverwriteExistingFiles) {
                $copyFlags += 0x10
            }
            
            # Create the Shell COM object
            $shell = New-Object -ComObject Shell.Application
            
            # Get references to the zip file and the destination folder as Shell Folder COM objects
            $zipFile = $shell.NameSpace($ZipFilePath)
            $destinationFolder = $shell.NameSpace($DestinationFolderPath)
            
            # Execute a file copy from the zip file to the destination folder; which effectively
            # extracts the zip file's contents to the destination folder
            $destinationFolder.CopyHere($zipFile.Items(), $copyFlags)
        } finally {
            # Release the COM objects
            if ($zipFile -ne $null) {
                [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($zipFile)
            }
            if ($destinationFolder -ne $null) {
                [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($destinationFolder)
            }
            if ($shell -ne $null) {                
                [void][System.Runtime.InteropServices.Marshal]::ReleaseComObject($shell)
            }
        }
    }
}

function mkdirs {
    mkdir $sDir\temp\ -force > $null
    mkdir $sDir\ProcessExplorer\ -force > $null
    mkdir "$start\Process Explorer" -force > $null
}

function shortcuts ($target, $link) {
    # Create a Shortcut with Windows PowerShell
    $TargetFile = $target
    $ShortcutFile = $link
    $WScriptShell = New-Object -ComObject WScript.Shell
    $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile)
    $Shortcut.TargetPath = $TargetFile
    $Shortcut.Save()
    }

# Variables
$sDir = $env:programfiles
#$uDir = $env:allusersprofile
$start = [Environment]::GetFolderPath('CommonStartMenu') + "\Programs"
$url = "http://download.sysinternals.com/files/ProcessExplorer.zip"
$file = $sDir + "\temp\ProcessExplorer.zip"

# Makes directories:
# ProcessExplorer directory in Program Files according to Environment variable\
# temp directory in Program Files for download
mkdirs
Get-Webclient $url $file
Start-Sleep -s 2
# Closes Process Explorer if running
Get-Process procexp* | stop-process –force
Expand-Zip $file "$sDir\ProcessExplorer\" -HideProgressDialog -OverwriteExistingFiles
Remove-Item "$sDir\temp\" -recurse
# Creates Start Menu shorcuts
shortcuts "$sDir\ProcessExplorer\Eula.txt" "$start\Process Explorer\EULA.lnk"
shortcuts "$sDir\ProcessExplorer\procexp.chm" "$start\Process Explorer\Process Explorer Help.lnk"
shortcuts "$sDir\ProcessExplorer\procexp.exe" "$start\Process Explorer\Process Explorer.lnk"
# Accepts EULA and starts minimized
start-process $sDir\ProcessExplorer\procexp.exe -ArgumentList "/AcceptEula /t"

 

Download ProcessExplorerInstaller.ps1 from Github
GitHub | PowerShell-Scripts / ProcessExplorerInstaller.ps1

Update: Patching VMWare ESXi 5.1

So I finally got around to patching my ESXi server which was several months behind. I thought I would just be able to use the same command I used previously wrote about to update it. That proved to be unsuccessful and all I got for my efforts were errors about the profile name. After some searching I discovered a new command to accomplish what I wanted.

esxcli software vib install -d /vmfs/volumes/Datastore/update.zip

Datastore is the name of the datastore the update is on and update.zip will be the patch file name. The complete command would look like this:

esxcli software vib install -d /vmfs/volumes/Storage/Updates/ESXi510-201307001.zip

Installation Result
Message: The update completed successfully, but the system needs to be rebooted for the changes to be effective.
Reboot Required: true

   VIBs Installed: etc....
   VIBs Removed: etc....
   VIBs Skipped: etc....

After running the command you should get a message saying something similar to result above. It will usually be followed by a long list of all the individual packages. Reboot your host either through the vSphere client or by typing

reboot

and your host should be updated once it finishes rebooting.

 

Shell Script: Splunk Syslog Server Update script

Here is a set of upgrade scripts I’ve created to automatically upgrade Splunk Syslog Server on Linux. This is primarily written with ubuntu server in mind, specifically 12.04 LTS, though it’s easily editable for other distributions. You can download the files below (they are automatically zipped with the latest version.

wget -q --secure-protocol="auto" -O "splunkget.sh" "https://raw.github.com/Smokex365/Splunk_Upgrade_Scripts/master/splunkget.sh"
chmod u+x splunkget.sh

Download splunkget.sh Stable
Download splunku.sh Stable

RoboForm: A full featured password manager and more

Lets face it: We have more passwords than we can ever remember. Whether it’s personal or work, we usually have dozens if not hundreds of username/password sets to remember for various applications and sites. The solution for most people is to reuse their username and passwords across sites. While this may make them easier to remember it also makes it easier for  them to be compromised. The common recommendation is to use passwords composed of alphanumeric characters (0-9, a-z, A-Z) and symbols. While that may increase the security of your passwords the likelihood of remembering one instance of “a320#.?atx!” is small, let alone 30 for a dozen different systems. It’s much easier to remember the name of a pet or a relative/spouse. So how do you get around the need for more secure passwords while  actually being able to remember the passwords themselves or instituting expensive biometric systems?  One answer is to use a password manager. There are several popular ones available but I favor RoboForm after having used it for several years. Why use a password manager and why choose RoboForm over other solutions? Well, lets dig in below and see!
Read more of this post

Using Google Chrome to make administration a breeze

Many people use Google Chrome on their personal computers to browse. It’s likely you use it on your work PC as well if your organization allows. Google Chrome loads most sites with ease, is frequently updated and has many customization options. It’s an all around good choice. It can also make your life as an admin much easier. A browser making administration easier? What magic is this? Well, lets look at some of the options.
Read more of this post

Verified by MonsterInsights