Current Version: 1.0
.SYNOPSIS
Compares the properties of an object with the parameters of a cmdlet.
.DESCRIPTION
Takes an object and examines the properties of the object and the parameters
of a cmdlet. It then produces an object in the pipeline of any properties
from the object that match a parameter of the cmdlet. Any properties from the
object that do not have a matching parameter in the cmdlet will be dropped.
===============================================================================
== Cmdlet: Merge-ParamarterData ==
== Version 1.0 ==
==---------------------------------------------------------------------------==
== Author: Jason A. Yoder ==
== Company: MCTExpert, Inc. ==
== Blog: MCTExpert.Blogspot.com ==
== Twitter: @JasonYoder_MCT ==
==---------------------------------------------------------------------------==
== License Information: ==
== Copyright 2013 - MCTExpert, Inc. ==
== This code is licensed for personal use only. This code may not be ==
== re published or distributed in whole or in part without the express ==
== written consent of MCTExpert, Inc. All rights reserved. ==
==---------------------------------------------------------------------------==
== Disclaimer: The user takes full responsibility for the execution of any ==
== PowerShell code. This code is provided without warranty or support. ==
== As with all PowerShell code, review it and test it in a test environment ==
== prior to using it in a production environment. The user takes complete ==
== responsibility for the results of executing this code. ==
===============================================================================
.PARAMETER Data
The object that you want to example to send to the cmdlet.
.PARAMETER Cmdlet
The cmdlet that you want to send the object to.
.EXAMPLE
IMPORT-CSV "C:\Process.csv" |
Merge-ParameterData -Cmdlet Get-Process|
Get-Process
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
------- ------ ----- ----- ----- ------ -- -----------
398 30 10664 11580 156 44.98 3472 ANT Agent
76 18 6560 7052 84 0.64 7024 calc
1157 70 64452 94348 399 27.28 7504 explorer
Takes a CSV file and compares the property names of the imported objects
to the parameter list of Get-Process. It them pipes the results to
Get-Process.
.EXAMPLE
Import-Csv C:\PS\Contacts.csv | Mearger-ParameterData -Cmdlet New-MailContact |
ForEach -Process {New-MailContact -Name $_.Name -DisplayName $_.DisplayName `
-ExternalEmailAddress $_.ExternalEmailAddress}
Creates mail contacts from a CSV file. The New-MailContact cmdlet
does not accept input from the pipeline on the Name or the ExternalEmailAddress
Parameters. This example shows you how to get around this issue.