Tag: Code

  • PowerShell Accepting Pipeline Input

    PowerShell Accepting Pipeline Input

    PowerShell Accepting Pipeline Input. There are two ways to accept pipeline input ValueFromPipeline = $true ValueFromPipelineByPropertyName = $true Related Links Prerequisite [cmdletbinding()]Param([Parameter(ValueFromPipeline)]] OR [Parameter(ValueFromPipelineByPropertyName)]]) ValueFromPipeline This method accepts the whole object as input and gives you access to all of the objects properties. ValueFromPipelineByPropertyName This method accepts only the value of a single property.Equivalent of…

  • Rounding Numbers in PowerShell

    Rounding Numbers in PowerShell

    Rounding Numbers in PowerShell $Number = 13.5 Cropping: [math]::Truncate($Number) 13 Rounding Down: [math]::Floor($Number) 13 Rounding Up: [math]::ceiling($Number) 14 Standard 0-4 Round Down 5-9 Round Up: [math]::Round($Number) 14