About 461,000 results
Open links in new tab
  1. Condition with a function call in PowerShell - Stack Overflow

    Apr 11, 2013 · If you want to compare the return value of a function in a conditional, you must group the function call (i.e. put it in parentheses) or (as @FlorianGerhardt suggested) assign …

  2. How to Call Function in If Statement in PowerShell? - SPGuides

    Jan 18, 2024 · In PowerShell, you can call a function within an if statement to execute code conditionally based on the function’s return value. For example, if you have a function called …

  3. Functions - PowerShell | Microsoft Learn

    Jan 23, 2025 · You can add the functions to a script module, put that module in a location defined in the $env:PSModulePath, and call the functions without needing to locate where you saved …

  4. Powershell calling function with parameter inside if statement

    I've wrote a function like this: Param( [Parameter(Mandatory=$False, ParameterSetName="Error")] [String[]] $ErrorName ) function Get-Err { if ($ErrorName -eq …

  5. Calling a specific PowerShell function from the command line

    Jan 23, 2015 · How do I invoke a specific function from the command line? This doesn't work: You would typically "dot" the script into scope (global, another script, within a scriptblock). Dotting a …

  6. Everything you wanted to know about the if statement - PowerShell ...

    Dec 18, 2023 · Like many other languages, PowerShell has statements for conditionally executing code in your scripts. One of those statements is the If statement. Today we will take a deep …

  7. Learn to use a PowerShell call function from another script

    Feb 26, 2021 · To start with a function call to a file, save the Get-IpAddress function in the first example to a file named Get-IpAddress.ps1. When you write a script that depends on a …

  8. How to use PowerShell If Else Statements — LazyAdmin

    Mar 17, 2023 · In this article, we are going to take a look at the PowerShell If Else statements, using the different methods like if not, if and, and how to use multiple conditions.

  9. How to Create and Use Functions in PowerShell

    Jun 29, 2024 · To call a function in PowerShell, you simply type the function’s name followed by parentheses. For example, given a function named Greet-User, you can call it by typing:

  10. Calling Functions In PowerShell – Basics, Syntax, And

    Jan 12, 2024 · Learn the basics of calling functions in PowerShell, syntax for calling functions, passing arguments, returning values, troubleshooting common issues, and best practices.

  11. Some results have been removed
Refresh