Category: Powershell

PowerShell New-PSDrive

PowerShell's Way of Mapping a Network Drive The modern method for mapping a network drive is to use New-PSDrive.  PowerShell 3.0 introduces the -Persist parameter so that we can not only see the name of your new drive in Windows explorer, but also know it's still there the next time …

Scripting PowerShell Functions

Introduction to Scripting PowerShell Function As you may expect from a top-notch scripting language, PowerShell supports functions.  There are several advantages of investing time in creating functions.  One benefits of a function is that once you get it working, it’s easy to call the commands later in the same script; …

PowerShell 3.0 Get-Childitem (gci)

What’s New with PowerShell 3.0 Get-Childitem? In PowerShell v 3.0 the Get-ChildItem cmdlet has new parameters.  You can list just folders (and not files) by appending -Directory.  I also like the -Attributes parameter, which can filter system or hidden files. Windows PowerShell 3.0 Get-ChildItem Topics Example 1: List Only Folders …

PowerShell Parameter Techniques

Techniques for PowerShell Parameters On this page I want to show you methods for researching PowerShell parameters. Exploit a Cmdlet’s Help File Find Cmdlets that Use a Particular Parameter List Positional PowerShell Parameters PowerShell Declaring Function Parameters  ♦ Exploit a Cmdlet’s Help File Each PowerShell cmdlet (or function) has it’s …

PowerShell 3.0 -PassThru

PowerShell 3 -PassThru Parameter PowerShell’s -PassThru parameter has found signficantly more uses in PowerShell 3.0. In a nutshell -PassThru shows you the results of a command that would otherwise be silent. Example 1: Out-GridView -PassThru Launching PowerShell 3.0 in Windows 8 What Else Is New In PowerShell 3.0?  ♦ Example …

PowerShell ConvertTo-Html

PowerShell ConvertTo-Html Cmdlet When testing PowerShell’s ConvertTo-Html cmdlet, the best way of making sense of the output is if you employ Invoke-Item to view the resulting web page. Topics for PowerShell’s ConvertTo-Html Introduction to ConvertTo-Html Example 1:  List Aliases in a Html file Example 2:  Research Processes and Their Handles …

PowerShell -Query Parameter

PowerShell -Query Parameter PowerShell’s -query parameter looks for a WMI Query Language (WQL) statement.  Invariably, the statement is introduced by a "Select * from …." construction.  In truth, "Select * from" was most useful in VBScript, but in PowerShell many a time the simpler statement works just as efficiently and …