Functions/Get-WITSqlrecordAsObj.ps1
<#
.Synopsis Short description .DESCRIPTION Long description .EXAMPLE Example of how to use this cmdlet .EXAMPLE Another example of how to use this cmdlet #> Function Get-WITSqlRecordAsObj { [CmdletBinding()] Param ( # Param1 help description [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, Position=0)] $Recordset ) Begin { } Process { $obj=New-Object -TypeName pscustomobject for ($i = 0; $i -lt $Recordset.fields.count; $i++) { $field_name=$recordset.Fields($i).name $value=$recordset.Fields.Item($i).Value $obj| Add-Member $field_name $value } #end for } End { return $obj } } |