About 14,700,000 results
Open links in new tab
  1. scripting - How to pass boolean values to a PowerShell script …

    Jul 13, 2015 · To provide a Boolean value for a switch parameter in the value of the File parameter, enclose the parameter name and value in curly braces, such as the following: -File …

  2. PowerShell Switch Parameter [With Examples]

    Jul 15, 2024 · Although switch parameters default to false, you might want to set a switch parameter to true by default. This can be done by setting the parameter’s default value in the …

  3. about_Parameter_Sets - PowerShell | Microsoft Learn

    Apr 10, 2025 · To create a parameter set, you must specify the ParameterSetName keyword of the Parameter attribute for every parameter in the parameter set. For parameters that belong …

  4. How to set mandatory parameters using parameters sets in PowerShell

    Mar 21, 2020 · In this article, I want to show you how to force your users to pass the proper arguments to your PowerShell scripts depending on data. I found this way for creating more …

  5. PowerShell Mandatory Parameter With Default Value

    Mar 11, 2025 · To define a mandatory parameter with a default value in PowerShell, you can use the Parameter attribute. This attribute allows you to specify various characteristics of the …

  6. How to Write Awesome Functions with PowerShell Parameter Sets

    Feb 3, 2021 · In this post, I will show you how to add parameter sets to your PowerShell functions. I will also demonstrate how to tell which parameter set is being used in the function. You can …

  7. How to set parameter variable to true if the parameter is

    Dec 21, 2020 · If I have a parameter (let's say a -Force) and I want the default to be false when it is not set, how can I get it to be true if the end user specifies it? Both in the case of doing …

  8. Booleans in PowerShell: A Comprehensive Guide - SharePoint Diary

    May 13, 2022 · To assign a value to the variable, you can use the $True and $False keywords, or you can use a comparison or logical operation to evaluate a Boolean result. The following …

  9. How to make a parameter mandatory based on the value of …

    Apr 19, 2017 · You can setup different parameter sets using parametersetname. Some careful planning is required to make sure there is no combination of parameters that will result in an …

  10. How do I make parameters mandatory in PowerShell?

    Jun 17, 2019 · To make a parameter mandatory add a "Mandatory=$true" to the parameter description. To make a parameter optional just leave the "Mandatory" statement out. This code …

  11. Some results have been removed
Refresh