About 11,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 · Write functions whenever possible because they're more tool-oriented. You can add the functions to a script module, put that module in a location defined in the …

  4. Powershell calling function from inside a function

    Mar 3, 2013 · In Powershell, variables created in functions stay in those functions, after it's done, the variables go with them. So if you are creating an object that you want to pass, you need to …

  5. In PowerShell, how do I define a function in a file and call it from ...

    May 16, 2011 · You certainly can define functions in script files (I then tend to load them through my Powershell profile on load). First you need to check to make sure the function is loaded by …

  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. 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: …

  8. How to create a PowerShell Function — LazyAdmin

    Mar 22, 2024 · Call Function. To call a function in PowerShell you need to keep in mind that you will need to declare the function first before you can call it. So your functions are at the top of …

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

    Feb 26, 2021 · When you write a script that depends on a function in a file, then you need to include the function in the script. To do this, use a method called dot-sourcing. The syntax for …

  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.

Refresh