Who fancies knowing when the rugby is on?

September 1st, 2015 No comments

Been messing around with some regex for some boring work related consumption of poorly constructed data – when I thought why not do something useful?

Rugby world Cup is around the corner – let’s make the schedule accessible from my Powershell session

(be warned, this was a quick and nasty – no comments, no instructions)

 

</pre>
Function Get-RugbySchedule
{
$fixturesXML = (invoke-webrequest -uri "http://www.ultimaterugby.com/match/list").ParsedHtml.body.innerHTML
$maincontent = $fixturesXML -split "main-content" | select -skip 1 -first 1

$items =  $maincontent | Select-String '(?s)(<DIV class=match-item.*?</SPAN></DIV></DIV>)' -AllMatches

$item = $items.matches[1].Value
$out = @()
foreach($item in $items.Matches.Value)
{
$ret = "" | select Detail, HomeTeam, AwayTeam, HomeScore, AwayScore, Status, Kickoff, Date, Venue, Tournament
$teams = ($item | Select-String '(?<=class=team-name>).*?(?=</SPAN>)' -AllMatches).Matches
if($teams.count -eq 2)
{
$ret.Hometeam = $teams[0].Value
$ret.AwayTeam = $teams[1].Value
$scores =  ($item | Select-String '(?<=(<SPAN class=score>|<SPAN class="score win">)).*?(?=</SPAN>)' -AllMatches).Matches
if($scores.Count -eq 2)
{
$ret.HomeScore =$scores[0].value
$ret.AwayScore = $scores[1].Value
}

}

$ret.Status = ($item | Select-String '(?<=<META content=)(.*?)(?=itemprop="eventStatus">)' -AllMatches).Matches[0].Value.Replace('"',"")
$ret.Detail = ($item | Select-String '(?<=<META content=)(.*?)(?=itemprop="name">)' -AllMatches).Matches[0].Value.Replace('"',"")

$kickoff = ($item | select-string '(?<=<DIV class=kickoff>).*?(?=</DIV>)').Matches.Value
$ret.Kickoff = ($kickoff | Select-String '([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]').Matches.Value
$ret.Date = ($kickoff | select-string '(?<=<SPAN class=date>)(.*?)(?=</SPAN>)').Matches.Value

$locationInfo =  ($item | Select-String '(?s)(?<=itemprop="location").*?(?=</DIV>)' -AllMatches).Matches.Value
$ret.Venue = ($locationInfo | select-string '(?<=>)(([a-zA-Z0-9_ ])+?)(?=<)').Matches.Value

$details = ($item | select-string '(?<=<DIV class=tournament>).*?(?=</DIV>)').Matches.Value
$ret.Tournament = ($details | select-string '(?<=>)(([a-zA-Z0-9_ ])+?)(?=<)').Matches.Value
$out += $ret
}
return $out
}

Categories: Powershell Tags: ,

Powershell behind a Proxy server

June 30th, 2015 No comments

so there I was, living in my Powershell session, when I stumbled across a cmdlet that looked kinda useful.
I wanted a little more info, but when I ran “get-help ” – I discovered that my local help files were out of date.

That’s easy to fix -no?:

Update-Help : Failed to update Help for the module(s) 'Microsoft.PowerShell.Management, Microsoft.PowerShell.Security,
Microsoft.PowerShell.Utility, CimCmdlets, ISE, Microsoft.PowerShell.Diagnostics, Microsoft.PowerShell.Host, Microsoft.WSMan.Management,
PSDesiredStateConfiguration, PSScheduledJob, PSWorkflow, PSWorkflowUtility, Microsoft.PowerShell.Core' with UI culture(s) {en-US} : Unable
to connect to Help content. The server on which Help content is stored might not be available. Verify that the server is available, or
wait until the server is back online, and then try the command again.
At line:1 char:1
+ update-help
+ ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Update-Help], Exception
    + FullyQualifiedErrorId : UnableToConnect,Microsoft.PowerShell.Commands.UpdateHelpCommand

errr . . .no!

Of course, I was in the office – behind a corporate proxy, that needed authentication . . and I needed my Powershell session to use my corporate proxy.

As it goes, the ie proxy settings are managed by GPO, so I figured I’d just use these.

First step – let’s check what our Powershell environment is using for its proxy:

netsh winhttp show proxy


Current WinHTTP proxy settings:

    Direct access (no proxy server).

hmm – not great, let’s change it

netsh winhttp import proxy source=ie
netsh winhttp show proxy

cool – we have now told Powershell to use our ie proxy.
Now, in our environment, we need to authenticate against the proxy.

If you manually authenticate (Username, Password) take this approach:

$webclient=New-Object System.Net.WebClient
$creds=Get-Credential
$webclient.Proxy.Credentials=$creds

Alternatively, if you are in a Domain environment and your proxy accepts NTLM/AD Auth, here’s what to do:

$webClient = new-object System.Net.WebClient
$webClient.Headers.Add(“user-agent”, “PowerShell Script”)
$webClient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials

Magic.

Now all that’s left to do is run

Update-Help

And try remember what it was that you were trying to achieve in the first place.

Categories: Powershell Tags:

Invoking SSH commands using powershell (kinda)

June 30th, 2015 No comments

Sometimes, you need to fire SSH commands from a Powershell session.
This is quite quick and easy if you have the right tools.

First of all, get the Posh-SSH cmdlets off github:
https://github.com/darkoperator/Posh-SSH

Install this like any other module (Drop it in your PSModulePath – else amend the code below to import the module from wherever you would like to execute it)
Now simply fire away using the module.

clever work (none of the credit to me)

I’ve used this for invoking SSH commands against ESX hosts, Dell iDracs and other SSH devices. Simple and quite reliable. I find it far more consistent than plink.exe etc

# Quick and untested copy of what you need:

Import-Module Posh-SSH

# Create Pwd (this saves a file copy)
# read-host -assecurestring | convertfrom-securestring | out-file $env:userprofile\$env:username.txt

# Retrieve info from file previously created under user profile
$username = "username@domain.net.intra"
$password = get-content $env:userprofile\$env:username.txt | convertto-securestring
$credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $username,$password

# Create SSH Session
$ssh = New-SSHSession -ComputerName $vmhost -Credential $credential -AcceptKey 1

# Invoke SSH command and capture output as string (you can return the full object if you like, I just needed the string Out)
$ret = $(Invoke-SSHCommand -SSHSession $ssh -Command "racadm getconfig -g cfgUserAdmin -i 2").Output

# return object is a String - if you want it as an array of strings for each row returned
$ret = $ret.split("`n")


# Clean up your mess
Remove-SSHSession -SSHSession $ssh
Remove-variable ssh

Categories: Powershell Tags:

Create ESXi Host firewall rules using PowerCli

February 13th, 2015 No comments

Recently, I needed to create some custom firewall rules on ESX hosts (lots of them) – for some Syslog servers that were in addition to our existing Syslog servers.

Here was my appraoach (note – Firewall rules will be lost at reboot unless you hack bootbank, or make the changes using custom VIBs)
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2007381

http://cormachogan.com/2014/03/28/adding-bespoke-firewall-rules-to-esxi/

The code has dependecnies on Posh-SSH (freely available, excellent automation tool)

# PowerCLI Script for enabling SSH, setting firewall and disable SSH alert in vCenter
# multiple dependencies 
# https://github.com/darkoperator/Posh-SSH 
# PowerCli


#Requires -Modules ActiveDirectory
#Requires -Version 4
#Requires -Modules Posh-SSH


# Sample update
import-module posh-ssh
add-pssnapin vm*
$vmhostname = read-host "Please provide target ESX hostname"
Connect-VIServer <viservname>
$Credential = Get-Credential -Message "Please provide root user password for $vmhostname" -UserName "root"

# enable SSH on ESX host (function below)
Set-SshOnVmHost -VMHostName $vmhostname -Status On

# Create firewall rule on ESX host
new-FireWallRuleonVmHost -VMHostName $vmhostname -direction outbound -protocol tcp -porttype dst -serviceID myServicename -port 1234 -enabled false -required false

# Display the change
$esxcli = Get-EsxCli -VMHost $vmhostname
$esxcli.network.firewall.ruleset.list()

# Disable SSH on the host
Set-SshOnVmHost -VMHostName $vmhostname -Status Off


function Set-SshOnVmHost
{
    Param(
        [String]
        $VMHostName,
        [ValidateSet('On','Off')]
        [String]
        $Status
        )

    	write-host "Configuring SSH on host: $($vmHost.Name) to $Status" -fore Yellow
        if((Get-VMHostService -VMHost $vmhostname | where {$_.Key -eq "TSM-SSH"}).Policy -ne "$Status"){
            Write-Host "Setting SSH service policy to automatic $status $($vmHost.Name)"
            Get-VMHostService -VMHost $vmhostname | where { $_.key -eq "TSM-SSH" } | Set-VMHostService -Policy "$Status" -Confirm:$false -ea 1 | Out-null
	    }
    
        $vmhost = get-vmhost $vmhostname
      
        $esxcli = Get-EsxCli -VMHost $vmhost
        if($Status -eq 'On'){
	        if((Get-VMHostService -VMHost $vmhost | where {$_.Key -eq "TSM-SSH"}).Running -ne $true){
                Write-Host "Starting SSH service on $($vmHost.Name)"
                Start-VMHostService -confirm:$false  -HostService (Get-VMHost $vmHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"}) | Out-null
                $ip = (Get-WmiObject -class win32_NetworkAdapterConfiguration -Filter 'ipenabled = "true"').ipaddress[0]
	            if($esxcli -ne $null){
                    if($ip.count -ne 1){
                        $ip = read-host "Please provide the IP address that should be to access this host via SSH"
                    }
                    try{
                        test-ipaddress $ip
                        if(($esxcli.network.firewall.ruleset.allowedip.list("sshServer") | select AllowedIPAddresses).AllowedIPAddresses -eq "All"){
                            Write-Host "Changing the sshServer firewall configuration"        
                            $esxcli.network.firewall.ruleset.set($false, $true, "sshServer")
                             if(($esxcli.network.firewall.ruleset.allowedip.list("sshServer") | select AllowedIPAddresses).AllowedIPAddresses -notmatch "$ip"){
                                $esxcli.network.firewall.ruleset.allowedip.add("$ip", "sshServer")
                            }
                            $esxcli.network.firewall.refresh()
                        }
                    }
                    catch {
                        throw "Unable to configure IP restirctions on Firewall when enabling SSH $_"		        
                    }
		        }
            }
        }
        else{
	        if((Get-VMHostService -VMHost $vmhost | where {$_.Key -eq "TSM-SSH"}).Running -ne $false){
                Write-Host "Stopping SSH service on $($vmHost.Name)"
                Stop-VMHostService -confirm:$false -HostService (Get-VMHost $vmHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"}) | Out-null
                write-host "Set Firewall rule too allow all IPs for SSH, but disable the service"
		        if(($esxcli.network.firewall.ruleset.allowedip.list("sshServer") | select AllowedIPAddresses).AllowedIPAddresses -ne "All"){
        	        Write-Host "Changing the sshServer firewall configuration"        
        		        $esxcli.network.firewall.ruleset.set($true, $true, "sshServer")
            	        $esxcli.network.firewall.refresh()
                }
            }
        }
            
	    # End Comment
	    if(($vmHost | Get-AdvancedSetting | Where {$_.Name -eq "UserVars.SuppressShellWarning"}).Value -ne "1"){
            Write-Host "Suppress the SSH warning message"
        	    $vmHost | Get-AdvancedSetting | Where {$_.Name -eq "UserVars.SuppressShellWarning"} | Set-AdvancedSetting -Value "1" -Confirm:$false | Out-null
        }
 }

 function Test-IPaddress
{
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$true,
                   ValueFromPipelineByPropertyName=$true,
                   Position=0)]
        [ValidateScript({$_ -match [IPAddress]$_ })]  
        [string]
        $IPAddress
    )

        [ipaddress]$IPAddress
}


# function for creation of a new Firewall rulle on an ESX host

function new-FireWallRuleonVmHost {
 Param( [Parameter(Mandatory=$true)]
        [String]
        $VMHostName,
        [Parameter(Mandatory=$true)]
        [ValidateSet('inbound','outbound')]
        [String]
        $direction,
        [Parameter(Mandatory=$true)]
        [ValidateSet('tcp','udp')]
        [String]
        $protocol,
        [Parameter(Mandatory=$true)]
        [ValidateSet('dst','src')]
        [String]
        $porttype,
        [Parameter(Mandatory=$true)]
        [String]$serviceID,
        [ValidateRange(0,65536)]
        [int]$port,
        [Parameter(Mandatory=$true)]
        [ValidateSet('true','false')]
        [String]
        $enabled,
        [Parameter(Mandatory=$true)]
        [ValidateSet('true','false')]
        [String]
        $required
        )

    # Create an SSH Session to the target
    $ssh = New-SSHSession -ComputerName $VMHostName -Credential $credential
   
    # Get the SSH Session's ID
    $sessionId = $($ssh.Index)
    
    # Copy original service.xml to .bak
    Invoke-SSHCommand -Command  "cp /etc/vmware/firewall/service.xml /etc/vmware/firewall/service.xml.bak" -Index $sessionId

    # Allow write access over existing service.xml
    Invoke-SSHCommand -Command  "chmod 644 /etc/vmware/firewall/service.xml" -Index $sessionId

    # Change the sticky bit
    Invoke-SSHCommand -Command  "chmod +t /etc/vmware/firewall/service.xml" -Index $sessionId

    # Create a local copy of the service.xml file
    $out = %{Invoke-SSHCommand -Command  "cat /etc/vmware/firewall/service.xml" -Index $sessionId}
    $out.Output > c:\temp\services.xml
    1$xml = $out.Output

    # Sort through IDs to find the highest current value (assuming 
    $ids = @(); $list = $xml.ConfigRoot.service | %{$_.id}  | ?{$_ -match '0'} | %{$ids += [int]$_}
    [string]$id = "`'00" +  (($ids | sort-object -Descending | select-object -First 1) + 1).ToString() + "`'";

    # insert xml for new service custom xml before closing  the closing <`/ConfigRoot`>
    $newXml = (get-content C:\temp\servicestmp.xml | Select-String -Pattern "`<`/ConfigRoot`>" -NotMatch) + @"
    <service id=$id>
        <id>$serviceID</id>
        <rule>
            <direction>$direction</direction>
            <protocol>$protocol</protocol>
            <porttype>$porttype</porttype>
            <port>$port</port>
        </rule>
        <enabled>$enabled</enabled>
        <required>$required</required>
    </service>
</ConfigRoot>
"@ > "C:\temp\services.xml"

    # copy new xml to services.xml on vm host
    Set-SCPFile -ComputerName $VMHostName -Credential $credential -LocalFile C:\temp\services.xml -RemoteFile /etc/vmware/firewall/service.xml
    
     # Prevet write access over service.xml
    Invoke-SSHCommand -Command  "chmod 444 /etc/vmware/firewall/service.xml" -Index $sessionId

    # Change the sticky bit
    Invoke-SSHCommand -Command  "chmod -t /etc/vmware/firewall/service.xml" -Index $sessionId
    
    # Refresh Firewall Rules on ESX host
    Invoke-SSHCommand -Command  "esxcli network firewall refresh" -Index $sessionId
       
    # remove the SSH Session that you created
    remove-sshSession -index $sessionId

}
Categories: Powershell, VMWare Tags:

Enabling / Disabling SSH on an ESX host and limiting access to only my current IP

February 13th, 2015 No comments

Enabling / Disabling SSH on ESXi – and limiting access to current IP only.


function Set-SshOnVmHost
{
Param(
[String]
$VMHostName,
[ValidateSet('On','Off')]
[String]
$Status
)

write-host "Configuring SSH on host: $($vmHost.Name) to $Status" -fore Yellow
if((Get-VMHostService -VMHost $vmhostname | where {$_.Key -eq "TSM-SSH"}).Policy -ne "$Status"){
Write-Host "Setting SSH service policy to automatic $status $($vmHost.Name)"
Get-VMHostService -VMHost $vmhostname | where { $_.key -eq "TSM-SSH" } | Set-VMHostService -Policy "$Status" -Confirm:$false -ea 1 | Out-null
}

$vmhost = get-vmhost $vmhostname

$esxcli = Get-EsxCli -VMHost $vmhost
if($Status -eq 'On'){
if((Get-VMHostService -VMHost $vmhost | where {$_.Key -eq "TSM-SSH"}).Running -ne $true){
Write-Host "Starting SSH service on $($vmHost.Name)"
Start-VMHostService -confirm:$false&nbsp; -HostService (Get-VMHost $vmHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"}) | Out-null
$ip = (Get-WmiObject -class win32_NetworkAdapterConfiguration -Filter 'ipenabled = "true"').ipaddress[0]
if($esxcli -ne $null){
if($ip.count -ne 1){
$ip = read-host "Please provide the IP address that should be to access this host via SSH"
}
try{
test-ipaddress $ip
if(($esxcli.network.firewall.ruleset.allowedip.list("sshServer") | select AllowedIPAddresses).AllowedIPAddresses -eq "All"){
Write-Host "Changing the sshServer firewall configuration"
$esxcli.network.firewall.ruleset.set($false, $true, "sshServer")
if(($esxcli.network.firewall.ruleset.allowedip.list("sshServer") | select AllowedIPAddresses).AllowedIPAddresses -notmatch "$ip"){
$esxcli.network.firewall.ruleset.allowedip.add("$ip", "sshServer")
}
$esxcli.network.firewall.refresh()
}
}
catch {
throw "Unable to configure IP restirctions on Firewall when enabling SSH $_"
}
}
}
}
else{
if((Get-VMHostService -VMHost $vmhost | where {$_.Key -eq "TSM-SSH"}).Running -ne $false){
Write-Host "Stopping SSH service on $($vmHost.Name)"
Stop-VMHostService -confirm:$false -HostService (Get-VMHost $vmHost | Get-VMHostService | Where { $_.Key -eq "TSM-SSH"}) | Out-null
write-host "Set Firewall rule too allow all IPs for SSH, but disable the service"
if(($esxcli.network.firewall.ruleset.allowedip.list("sshServer") | select AllowedIPAddresses).AllowedIPAddresses -ne "All"){
Write-Host "Changing the sshServer firewall configuration"
$esxcli.network.firewall.ruleset.set($true, $true, "sshServer")
$esxcli.network.firewall.refresh()
}
}
}

# End Comment
if(($vmHost | Get-AdvancedSetting | Where {$_.Name -eq "UserVars.SuppressShellWarning"}).Value -ne "1"){
Write-Host "Suppress the SSH warning message"
$vmHost | Get-AdvancedSetting | Where {$_.Name -eq "UserVars.SuppressShellWarning"} | Set-AdvancedSetting -Value "1" -Confirm:$false | Out-null
}
}
Categories: Uncategorized Tags:

Getting up and ruinning with the vSphere SDk for c#

September 25th, 2013 No comments

Getting up and running with vSphere webservice APIs to code custom tools for VMware automation

if you are anything like me, this is something you have weanted to play with . . but every time you tried, you get stuck in the myriad of partisal information on the web. alwaysd specific to a particular version of Visual Studio, or copy of the Vmware SDKs.

This is how I got up and running:

From:
http://pubs.vmware.com/vsphere-55/index.jsp#com.vmware.wssdk.dsg.doc/sdk_c_sharp_development.5.3.html?path=7_0_0_0_2_1_0#1002780

To set up a development workstation to use C#

1 Install the Microsoft Visual programming environment, such as Microsoft Visual C# or Microsoft Visual Studio.
Use Microsoft Visual Studio 2008 or later, which includes the required .NET Framework.

2 Obtain the Microsoft .NET Framework, if it is not included in the Microsoft Visual programming environment.
Use .NET version 3.5 or later, according to your Visual Studio version.

3 Download and install the Microsoft .NET Framework 2.0 SDK (x64) from http://www.microsoft.com/en-us/download/details.aspx?id=15354
Note Virtual Studio includes a version of .NET version 2.0, but that version does not contain the tools needed to build the DLLs.

4 Find the location where the Microsoft .NET Framework 2.0 SDK (x64) files were installed. Verify that the installation directory contains a subdirectory named Bin, which contains a file named wsdl.exe. Typically, the Framework SDK is installed at C:\Program Files\Microsoft.NET\SDK\v2.0 64bit.
5 Edit your Windows registry to identify the location where the Microsoft .NET Framework 2.0 SDK (x64) was installed. Under the key HKLM\SOFTWARE\Microsoft\.NETFramework, verify that there is a string value named sdkinstallRootv2.0 with a string value of the full path name to the installation directory. If sdkinstallRootv2.0 is not present, add it.

6 Download and install Microsoft Web Services Enhancements (WSE) 3.0 from http://www.microsoft.com/en-us/download/details.aspx?id=14089.
Note The default option for the WSE installer includes only the runtime, not the WSDL tool. Select another option to include the Tools directory.

7 Download and unzip the VMware vSphere Web Services SDK package from the VMware Web site at http://www.vmware.com/download/sdk/. (actually – https://my.vmware.com/group/vmware/details?downloadGroup=WEBSDK550&productId=353)

Assuming default locations for Above installs, (again more info in above doc), launch your Visual studio command prompt (not a normal Dos / Powershell Shell, as these don’t have access to all the VS tools)

Create the WSE_HOME environment variable, setting its value to the absolute path to the directory where WSE was installed. For example:
set WSE_HOME=C:\Program Files (x86)\Microsoft WSE\v3.0
(Note the doc linked above has a spelling typo in the path – programe, not program)

Add the WSE tools directory to the PATH environment variable:
set PATH=%PATH%;%WSE_HOME%\Tools

Create the SDK_HOME environment variable, setting its value to the absolute path to the directory containing all the SDK files extracted from the zip file you downloaded. For example:
set WS_SDK_HOME=D:\vSphere5.5_SDK\SDK

Create the WSDLHOME environment variable, setting its value to the absolute path to the directory where the WSDL files were stored when you uncompressed the SDK download file. – Assuming you used the same folder as me to extract tghe SDK to (D:\vSphere5.5_SDK) you need to do the following:
set WSDLHOME=D:\vSphere5.5_SDK\SDK\vsphere-ws\wsdl\vim25

If your Microsoft development and .NET software has not been installed using default paths, create and set the VSINSTALLDIR environment variable

Now, I only wanted to manage vSphere and use the sample programs, however, it seems that the samples need a DLL created in the SSO step of this doc. so next step as follows:

### Building the vSphere DLLs
You have some automated samples available on the web here to create the DLLs:

Scripted (more or less what I’ll do below)
http://codechief.wordpress.com/2012/10/23/generating-vmware-web-service-proxies-for-net/#comments

Extraction from PowerCli (this is quick and easy)
http://codechief.wordpress.com/2013/04/24/extracting-vmware-web-service-proxies-for-net/

Navigate to the .NET subdirectory for SSO client samples.
cd %WS_SDK_HOME%\ssoclient\dotnet\cs\samples

Generate a test certificate and STSService stubs using the build.bat script.
.\build.bat

Copy the SSO DLL to the %SDK_HOME%\vsphere-ws\dotnet\cs\samples\DLLs directory.
copy lib\STSService.dll %WS_SDK_HOME%\vsphere-ws\dotnet\cs\samples\DLLs\.

# Now for the vSphere Dlls

Navigate to the .NET subdirectory for vSphere client samples.
cd D:\vSphere5.5_SDK\SDK\vsphere-ws\dotnet\cs\samples

Generate the VimService.cs file from the WSDL, using the following command syntax with the WSE WSDL tool:
wsewsdl3.exe /n:Vim25Api /type:webClient /l:CS "D:\vSphere5.5_SDK\SDK\vsphere-ws\wsdl\vim25\vim.wsdl" "D:\vSphere5.5_SDK\SDK\vsphere-ws\wsdl\vim25\vimService.wsdl"
This command generates VimService.cs, the default output file, in the current directory, using the Vim25Api namespace.

Compile VimService.cs into a library, using the following command syntax:
csc /t:library /out:Vim25Service.dll /r:"C:\Program Files (x86)\Microsoft WSE\v3.0\Microsoft.Web.Services3.dll" VimService.cs
This command generates a serializer assembly, a DLL.

Use the sgen tool to pre-generate and compile the XML serializers, using the following command syntax:
sgen /p Vim25Service.dll
This command outputs the Vim25Service.XmlSerializers.dll file in the current directory. This DLL file contains pre-generated XML serializer code.

Using a source code editor (notepad++ for me – Hit Ctrl H and do a search and replace), find occurrences of the following string in the VimService.cs file that you generated 3 steps ago (D:\vSphere5.5_SDK\SDK\vsphere-ws\dotnet\cs\samples\VimService.cs)
[System.Xml.Serialization.XmlIncludeAttribute
Replace occurrences of the string with:
// [System.Xml.Serialization.XmlIncludeAttribute
This will prevent .NET from processing the Xml.Serialization.XmlIncludeAttribute attributes that are the main cause of the slow instantiation of the Vim25Service class.

Annotate the VimService class in the VimService.cs file that you generated, adding this XmlSerializerAssemblyAttribute to point to the location of the XML serializer assembly:
[System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = “Vim25Service.XmlSerializers")]
The result should look something like the following example:
// ... Some code here ...
[System.Xml.Serialization.XmlSerializerAssemblyAttribute(AssemblyName = “Vim25Service.XmlSerializers")]
public partial class VimService : Microsoft.Web.Services3.WebServicesClientProtocol {
// ... More code here.

Save the modified VimService.cs file.

Regenerate the Vim25Service.dll library with the following command syntax:
csc /t:library /out:Vim25Service.dll /r:"C:\Program Files (x86)\Microsoft WSE\v3.0\Microsoft.Web.Services3.dll" VimService.cs

Copy the generated files Vim25Service.dll and Vim25Service.XmlSerializers.dll to the “D:\vSphere5.5_SDK\SDK\vsphere-ws\dotnet\cs\samples\DLLs” directory.
copy Vim25Service*.dll DLLs

### Generate the DLL for SSO:
In the Visual Studio command shell that you have open:

Navigate to the .NET subdirectory for SSO client samples.
cd "D:\vSphere5.5_SDK\SDK\ssoclient\dotnet\cs\samples"

# Building the samples:
Launch Visual Studio and load the solution file, Samples2008.sln.
The solution file is found in the D:\vSphere5.5_SDK\SDK\vsphere-ws\dotnet\cs\samples directory.
If you are using a version of Visual Studio later than 2008, the Visual Studio Conversion Wizard will prompt you to convert the 2008 solution file to the newer version. If you also have Visual Studio 2008, you should select Yes when the wizard offers to save a backup of the original solution file.

If you are using a version of Visual Studio later than 2008, convert each project to use .NET Framework 4.
The projects in the 2008 solution file are configured to use .NET Framework 3.5. To convert a project to use .NET Framework 4, right-click its name in the Solution Explorer and select Properties. In the Properties panel, change the Target Framework from .NET Framework 3.5 to .NET Framework 4.

From the Visual Studio menu, select Build > Build Solution.
All the sample programs build. The Output pane at the bottom of the Visual Studio window shows build errors, if any.

Correct any errors in the build, and repeat the build.

At this point, you should be able to import the solution contain all the projects from the sameples folder.

These are command line apps, but should allow you to get started,

Categories: Uncategorized Tags:

vSphere 5.5 new features and enhancements

August 29th, 2013 No comments

As usual, it is VMWorld in the US . . and I am not there.

but for my own notes (more than anyone else’s), I figured I’d run through the new features – and post them on here as a reference.

From: http://www.vmware.com/files/pdf/vsphere/VMware-vSphere-Platform-Whats-New.pdf

VMware vSphere® 5.5 introduces many new features and enhancements to further extend the core capabilities
of the vSphere platform. This paper will discuss features and capabilities of the vSphere platform,
including vSphere ESXi Hypervisor™, VMware vSphere High Availability (vSphere HA), virtual machines,
VMware vCenter Server™, storage networking and vSphere Big Data Extensions.

vSphere ESXi Hypervisor Enhancements
––Hot-Pluggable SSD PCI Express (PCIe) Devices –

This is a great addition (one of my favourites) – and should a great benefit in VDI type environments
––Support for Reliable Memory Technology –

Nice concept, using CPU to “grade” memory and commit important VMkernel and other critical component instructions. Essentially meansing that worst case, bad memory should affect VMs only and not bring the whole ESXI to its knees
––Enhancements for CPU C-States –

Effectively reduced means that CPUs are running at a lower frequency and voltage, meaning they are generally running more efficiently and cooler, potentially allowing for inherent increased performance, because turbo mode frequencies on Intel can be reached quicker on cool CPUs.
Virtual Machine Enhancements
––Virtual Machine Compatibility with VMware ESXi™ 5.5 –

new features such as LSI SAS support
for Oracle Solaris 11 OS, enablement for new CPU architectures, and a new advanced host controller interface
(AHCI).
––Expanded vGPU Support-

With vSphere 5.5, vGPU support has been expanded to include both Intel- and AMD-based GPUs hardware-accelerated 3D graphics—virtual
graphics processing unit (vGPU).

––Graphic Acceleration for Linux Guests –

With the new guest driver, modern Linux distributions are enabled to support technologies such as
the following:
• OpenGL 2.1
• DRM kernel mode setting
• Xrandr
• XRender

VMware vCenter Server Enhancements
––VMware® vCenter™ Single Sign-On

vCenter Single Sign-On
vCenter Single Sign-On server 5.5, the authentication services of the vSphere management platform, can now
be configured to connect to its Microsoft SQL Server database without requiring the customary user IDs and
passwords, as found in previous versions.

 

 
––VMware vSphere Web Client

The Web Client is becoming the defacto  method of accessing and managing your environment. Tied with SSO,it means you should be able to manage your envuironment from ANY machine on your network – and hopefully from any platform (tablets, PCs, phones?)

––VMware vCenter Server Appliance™

Appliance now uses a reengineered, embedded vPostgres database that can now support as many as 500
vSphere hosts or 5,000 virtual machines.

––vSphere App HA

This new feature works in conjunction with vSphere HA host monitoring and virtual machine
monitoring to further improve application uptime. vSphere App HA can be configured to restart an application
service when an issue is detected. It is possible to protect several commonly used, off-the-shelf applications.
vSphere HA can also reset the virtual machine if the application fails to restart.

––vSphere HA and VMware vSphere Distributed Resource Scheduler™ (vSphere DRS)

To address the need for maintaining placement of virtual machines on separate hosts—without
vSphere vMotion migration—after a host failure, vSphere HA in vSphere 5.5 has been enhanced to conform
with virtual machine–virtual machine antiaffinity rules. Application availability is maintained by controlling
the placement of virtual machines recovered by vSphere HA without migration. This capability is configured
as an advanced option in vSphere 5.5.

––vSphere Big Data Extensions

BDE performs the following functions on the virtual Hadoop clusters it manages:
• Creates, deletes, starts, stops and resizes clusters
• Controls resource usage of Hadoop clusters
• Specifies physical server topology information
• Manages the Hadoop distributions available to BDE users
• Automatically scales clusters based on available resources and in response to other workloads on the
vSphere cluster

 

• vSphere Storage Enhancements
––Support for 62TB VMDK

The previous limit
was 2TB—512 bytes. The new limit is 62TB.

––MSCS Updates

Historically, shared storage was supported in MSCS environments only if the protocol used was Fibre Channel
(FC). With the vSphere 5.5 release, this restriction has been relaxed to include support for FCoE and iSCSI. – FINALLY!!!

 
––16GB E2E support

In vSphere 5.5, VMware introduces 16Gb end-to-end FC support. Both the HBAs and array controllers can run at
16Gb as long as the FC switch between the initiator and target supports it.

––PDL AutoRemove

With vSphere 5.5, a new feature called PDL
AutoRemove is introduced. This feature automatically removes a device from a host when it enters a PDL state.

––vSphere Flash Read Cache

vSphere Flash Read Cache enables the pooling of multiple Flash-based devices into a single consumable
vSphere construct called vSphere Flash Resource, which is consumed and managed in the same way as CPU
and memory are done today in vSphere.
The vSphere Flash Read Cache infrastructure is responsible for integrating the vSphere hosts’ locally attached
Flash-based devices into the vSphere storage stack. This integration delivers a Flash management platform that
enables the pooling of Flash-based devices into a vSphere Flash Resource.

 

http://www.vmware.com/files/pdf/vsphere/VMware-vSphere-Platform-Whats-New.pdf

Categories: Uncategorized Tags:

Free TrainSignal access for vExperts

May 31st, 2013 No comments

Train Signal have very generously offered free access for 12 months to all vExperts!

http://www.trainsignal.com/blog/2013-vexperts-trainsignal

They offer training courses (over 1500 of them) and plenty video learning. The package is worth about $49 a month, so it is an extremely generous offer!

Thanks TrainSignal

 

Categories: Uncategorized Tags:

vExpert 2013 awardees announced

May 29th, 2013 No comments

VMWare (John Troyer/ Corey Romero) has  announced the list of people who have been selected as vExperts for 2013.

http://blogs.vmware.com/vmtn/2013/05/vexpert-2013-awardees-announced.html

I am thrilled and honored to have made onto the panel for a second year running!

Thanks so much to the guys over at VMWare! I look forward to another year.

Congratulations to all the other nominees – both old and new.

 

For those who don’t know, the vExpert award is not a technical certification, but a recognition for what you’ve done for the community during the preceding year

Quote from the announcement:

We’re pleased to announce the list of vExperts for 2013. Each of these vExperts have demonstrated significant contributions to the community and a willingness to share their expertise with others. We are blown away by the passion and knowledge in this group, a group that is responsible for much of the virtualization evangelism that is taking place in the world — both publicly in books, blogs, online forums, and VMUGs; and privately inside customers and VMware partners. Congratulations to you all!

Categories: VMWare Tags:

VMware Forum London – VMware Forum 2013

March 22nd, 2013 No comments

Registration for VMware forum London is open

VMware Forum London – VMware Forum 2013.

Went to this last year, it was a great event, with some fantastic speakers and decent opportunity to network with other guys in the field.
saw quite a few vExperts and VCDXs there last year too.

Categories: VMWare Tags: