Showing tag results for PowerTip

Sep 11, 2012
Post comments count0
Post likes count0

PowerTip: Discovering PowerShell Functions

Doctor Scripto

Summary: Learn how to discover Windows PowerShell 3.0 functions.  How can I find all of the functions that exist in my Windows PowerShell 3.0 installation? a. Use the Function drive:             Dir Function: b. First import all of the modules, and then perform a direc...

Scripting Guy!Windows PowerShellPowerTip
Sep 10, 2012
Post comments count0
Post likes count0

PowerTip: Working with the Maximum History Setting

Doctor Scripto

Summary: Learn how to increase the maximum history value.    How can I increase the number of commands that are stored in the Windows PowerShell command history?  Specify a new value for the $MaximumHistoryCount automatic variable.    In Windows PowerShell 3.0, the variable is set to 4096, but you can store u...

Scripting Guy!Windows PowerShellPowerTip
Sep 9, 2012
Post comments count0
Post likes count0

PowerTip: Two Quick Ways to Check Variables in PowerShell

Doctor Scripto

Summary: Check for undeclared variables.  How can I cause the script to generate an error if a variable has not been declared?  Here are a couple of ways to do this with Windows PowerShell. a. Place set-psdebug –strict anywhere in the script. Any nondeclared variable will generate an error when accessed. b. Use Set-Stric...

Scripting Guy!Windows PowerShellPowerTip
Sep 8, 2012
Post comments count0
Post likes count0

PowerTip: Don’t Name a Variable $input

Doctor Scripto

Summary: Advice against using $input for a variable name.  Can I use a variable named $input to hold input from the Read-Host cmdlet?  $input is an automatic variable that is used for script blocks in the middle of a pipeline. As such, it would be a very poor choice.  Call the variable something ...

Scripting Guy!Windows PowerShellPowerTip
Sep 7, 2012
Post comments count0
Post likes count0

PowerTip: Use PowerShell to Obtain User Input

Doctor Scripto

Summary: Learn how to use Windows PowerShell to solicit user input.   How can I solicit input from the user?  Use the Read-Host cmdlet: $in = Read-host “enter the data”  

Scripting Guy!Windows PowerShellPowerTip