To forward function parameters to a cmdlet, use $psboundparameters automatic variable and splatting. Here is a sample:
function Get-BIOS($ComputerName, $Credential) {
Get-WmiObject Win32_BIOS @psboundparameters
}
Your function Get-BIOS works both locally and remotely. Only the parameters submitted by the user will actually be forwarded to Get-WmiObject.
ReTweet this Tip!
Posted
Sep 16 2011, 06:00 AM
by
ps1