PoshCode Archive  Artifact [0f316ac574]

Artifact 0f316ac5745831046f5da83dbfe054e42e228ca2f572ebbc048f2d47c1e14ea0:

  • File A-Process-Block.ps1 — part of check-in [f79013ba96] at 2018-06-10 12:56:32 on branch trunk — A Process Block (user: unknown size: 714)

# encoding: ascii
# api: powershell
# title: A Process Block
# description: A Process Block
# version: 0.1
# type: script
# license: CC0
# x-poshcode-id: 1145
# x-archived: 2009-06-07T13:29:24
#
#
Process { 
	#Get the type of object we have
	$InputTypeName = $_.GetType().Name 
    
	#Do something with that object
	#is it VMware?
	if ( $InputTypeName -eq "VMHostImpl" ) { 
        	$output = $_ | Get-View | Select-Object $VMHost_UUID 
	#is it Xen?
	} elseif ($InputTypeName -eq "Host"){
		$output = $_ | get-view | Select-Object $XenHost_UUID 
	#Otherwise throw an error
	} else { 
	        Write-Host "`nPlease pass this script either a VMHost or VM object on the pipeline.`n" 
	} 
}