Tuesday, March 1, 2016

Migrate a virtual machine's network from a Key/Value pair

<#
.SYNOPSIS
   <A brief description of the script>
.DESCRIPTION
   <A detailed description of the script>
.PARAMETER viserver
Virtual Infrastructure Server name
.PARAMETER vmguest
Virtual Machine Name
.EXAMPLE
  Migrate-myvmnetwork -viserver vcenter -vmguest myvmguest
#>

#constants
#$NetworkKey = Name,Value
#OldnetworkName    NewNetworkName
#$NetworkKey.Name  $NetworkKey.Value

function Migrate-MyVMNetwork {
param(
[Parameter(Position=0, Mandatory=$true)][System.String]$viserver,
[Parameter(Position=1, Mandatory=$true)][System.String]$vmguest
)

$NetworkKey=@{
"oldnetworkname"="newNetworkName"
}

try{connect-viserver $viserver -ea stop|Out-Null}
catch { write-host $viserver "failed to connect";break }

$vm=get-vm $vmguest
$VMNetworkAdapters=$vm|Get-NetworkAdapter

foreach($VMNetworkAdapter in $VMNetworkAdapters){
if ($networkKey.containskey($VMNetworkAdapter.networkname)){
$NIC=$VMNetworkAdapter.Name
$oldNetworkName=$VMNetworkAdapter.networkname
$NewNetworkName=$networkKey.Get_Item($VMNetworkAdapter.networkname)
$PortGroup=Get-VDPortgroup -Name $NewNetworkName
Write-Host "VM Name:" $vm.Name
Write-Host "old network:" $oldNetworkName -ForegroundColor red
Write-Host "New Network:" $NewNetworkName  -ForegroundColor Green
Write-Host "Port Group Name:" $PortGroup
#you can out-null this
$vm|Get-NetworkAdapter|?{$_.name -eq $nic}|Set-NetworkAdapter -PortGroup $PortGroup|ft -AutoSize
}
Elseif ($networkKey.containsvalue($VMNetworkAdapter.networkname)) { Write-Host $vm.Name ":" $vmnetworkadapter " Already Migrated." -ForegroundColor yellow }

else {Write-Host $vm.name ":" $vmnetworkadapter ":" $oldNetworkName ": Old name not in key pair." -ForegroundColor RED }

#paranoid
$NIC=""
$oldNetworkName=""
$NewNetworkName=""
$PortGroup=""
}
Disconnect-VIServer $viserver -confirm:$false

#paranoid
$VMNetworkAdapters=$null
$VM=$null
}

Monday, June 22, 2015

Removing a file from VMFS volume fails with the error: Resource temporarily unavailable (2063629)

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2063629

Removing a file from VMFS volume fails with the error: Resource temporarily unavailable (2063629)

  • Deleting a file from a VMFS datastore in the vSphere Client or the vSphere CLI fails.
  • You see the error:

    Resource temporarily unavailable
  • When you attempt to delete a file from a VMFS datastore, the vmkernel.log file reports an error similar to:  
cpu6:5455056)FS3: 1393: vol 'datastore_name', lock at 173475840: [Req mode: 1] Not free:
cpu6:5455056)[type 10c00004 offset 173475840 v 158, hb offset 3338752gen 4307, mode 1, owner 51b23791-f35c96e9-44ed-3c4a92f61680 mtime 2278287
cpu6:5455056)Res3: 5696: Rank violation threshold reached: cid 0xc1d0000c, resType 3, cnum 1410
cpu6:5455056)Fil3: 15247: Max retries (10) exceeded for caller Fil3RemoveCore (status 'Lock rank violation detected')

Note: The location of the vmkernel.log file:
  • ESXi 5.5, 5.1 and 5.0: /var/log/
  • ESXi 3.5 and 4.x: /var/log/messages/

This issue occurs if an ESXi host on the vCenter Server holds a lock on the file you are trying to delete.   

To resolve this issue:

Tuesday, June 16, 2015

FileMaker 14 Offline Installation - Since FM can't write decent documentation

Purpose:  To assist installing FileMaker 14 offline as it the server doesn’t have access to the internet.


This document assumes the following:
1.      You are attempting to install with the extracted files placed in C:\Filemaker Server 14v2 (see below for instructions)
2.      You have modified Assisted Install.txt (see below for instructions)
3.      You have modified the setup.ini file (see below for instructions)
4.      You have installed the required Application Request Routing Package ref: Application Request Routing 3.0 Stand-alone package (IExpress) x64 (http://www.microsoft.com/en-us/download/details.aspx?id=47332)

Installing the application from the command line

1.      Open the command prompt
2.      Type cd “C:\Filemaker Server 14v2\files” and press ENTER 
3.      Type setup.exe /V”/log %temp%\FM14InstallLog.log ARRINSTALLED=1” and press ENTER
4.      Click NEXT through the installer and adjust as needed.  Refer to product installation documents as it is outside the scope of this document.
5.      At the completion continue with configuring FileMaker as necessary

How to extract the installation files

1.      Double-Click the installation file assuming fms_14.0.2.226 (version 14v2)
2.      It will extract automatically to a subdirectory of the version name you launched it from I.E. C:\FileMaker Server 14v2
3.      Click Cancel to break the install routine

How to modify the Assisted Install.txt file

               Assuming the directory name C:\FileMaker Server 14v2
1.      Open the file C:\FileMaker Server 14v2\Files\Assisted Install.txt in Notepad
2.      Enter the License information as indicated Name/Organization/License Key
3.      Save and Exit Notepad

How to modify the setup.in file to prevent the download prerequisite

               Assuming the directory name C:\FileMaker Server 14v2
               Assuming the pre-requisite line is PreReq0

1.      Open the file C:\FileMaker Server 14v2\Files\Setup.ini in Notepad
2.      Scroll to the [ISSetupPrerequisites] section
3.      Delete the line that indicates PreReq0=Application Request Routing 3.0 (Download).prq
4.      Delete the line that indicates PreReq0=Common
5.      Save and Exit Notepad


Tuesday, May 5, 2015

PVSCSI Processor Utilization

I find the CPU utilization interesting when using PVSCSI driver

Test Parameters:

1 GB File
10 Second duration
No write activity only read performance
Randomized
8KB
1 thread
Latency info captured
no hardware/software caching

Luns are presented in both datacenter

Intel-r1:
Datastore A6

SCSI Controller: LSI Logic SAS
VMXNET3


Intel-r2:
        Remote Datacenter
Datastore A0

SCSI Controller: ParaVirtual
VMXNET3

Server-r1

Local on SX1
Run 1, 15836.69 iops, 123.72 MB/sec, 0.626 ms, 20.20% CPU
Run 2, 14622.15 iops, 114.24 MB/sec, 0.679 ms, 18.53% CPU
Run 3, 17374.64 iops, 135.74 MB/sec, 0.570 ms, 22.66% CPU
Run 4, 15767.63 iops, 123.18 MB/sec, 0.629 ms, 18.20% CPU
Run 5, 19634.08 iops, 153.39 MB/sec, 0.504 ms, 23.16% CPU
Run 6, 20334.63 iops, 158.86 MB/sec, 0.487 ms, 23.40% CPU
Run 7, 20507.43 iops, 160.21 MB/sec, 0.483 ms, 22.73% CPU
Run 8, 20918.63 iops, 163.43 MB/sec, 0.473 ms, 22.77% CPU

Remote Read from Server-r2 on remote SXC1 server

Run 1, 4190.29 iops, 32.74 MB/sec, 2.386 ms, 21.61% CPU
Run 2, 3957.42 iops, 30.92 MB/sec, 2.522 ms, 20.91% CPU
Run 3, 3675.10 iops, 28.71 MB/sec, 2.717 ms, 19.26% CPU
Run 4, 3423.77 iops, 26.75 MB/sec, 2.913 ms, 26.76% CPU
Run 5, 3605.29 iops, 28.17 MB/sec, 2.769 ms, 19.37% CPU
Run 6, 3338.81 iops, 26.08 MB/sec, 2.991 ms, 17.77% CPU
Run 7, 2382.91 iops, 18.62 MB/sec, 4.192 ms, 12.85% CPU
Run 8, 2764.14 iops, 21.59 MB/sec, 3.613 ms, 15.66% CPU

Server-R2

local on SXC1
Run 1, 4624.96 iops, 36.13 MB/sec, 2.158 ms, 4.24% CPU
Run 2, 3652.52 iops, 28.54 MB/sec, 2.735 ms, 1.85% CPU
Run 3, 8326.79 iops, 65.05 MB/sec, 1.198 ms, 4.21% CPU
Run 4, 6511.88 iops, 50.87 MB/sec, 1.532 ms, 3.08% CPU
Run 5, 7673.32 iops, 59.95 MB/sec, 1.299 ms, 5.37% CPU
Run 6, 8512.71 iops, 66.51 MB/sec, 1.171 ms, 4.01% CPU
Run 7, 9639.73 iops, 75.31 MB/sec, 1.034 ms, 4.56% CPU
Run 8, 9401.47 iops, 73.45 MB/sec, 1.060 ms, 4.36% CPU

Remote Read from Server-r1 on SX1

Run 1, 4906.13 iops, 38.33 MB/sec, 2.034 ms, 17.31% CPU
Run 2, 4437.13 iops, 34.67 MB/sec, 2.249 ms, 14.33% CPU
Run 3, 4556.07 iops, 35.59 MB/sec, 2.191 ms, 12.64% CPU
Run 4, 4862.19 iops, 37.99 MB/sec, 2.053 ms, 14.76% CPU
Run 5, 4789.36 iops, 37.42 MB/sec, 2.085 ms, 16.89% CPU
Run 6, 4696.56 iops, 36.69 MB/sec, 2.125 ms, 14.51% CPU
Run 7, 5259.87 iops, 41.09 MB/sec, 1.897 ms, 16.53% CPU
Run 8, 4713.28 iops, 36.82 MB/sec, 2.117 ms, 15.63% CPU

Tuesday, April 21, 2015

sample prompt

title = "Continue?"
$message = "If the settings are correct, Press Y to Continue?"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes"
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No"
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
$choice=$host.ui.PromptForChoice($title, $message, $options, 1)

if ($choice -eq 1){Write-Warning "You pressed no.  Exiting script routine.";break}
Else { 'Do something Special }

Use User Credentials in MDT 2013 to Run Powershell Script

#UserName
$tmpuser=$tsenv:UserID
$tmpuser=[System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String($tmpuser))

#DomainName
$tmpdomain=$tsenv:UserDomain
$tmpdomain=[System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String($tmpdomain))

#set password to variable
$tmppassword=$tsenv:UserPassword

#Decode Password
[string]$tmppassword=[System.Text.Encoding]::Default.GetString([System.Convert]::FromBase64String($tmppassword))

#Convert to secure string
$mypassword=ConvertTo-SecureString -String $tmppassword -AsPlainText -Force

#format domainname\username for PSCredential object
[string]$tmpFQusername=$tmpdomain + "\" + $tmpuser

$creds = new-object System.Management.Automation.PSCredential($tmpFQusername,$mypassword)


Place the above code into your custom scripts to use PScredentials

Monday, April 13, 2015

Living List of Hotfixes for various components at Microsoft.

List of Failover Cluster related hotfixes post RTM for Windows Server 2012 R2 RTM