Showing tag results for PowerTip

Sep 6, 2012
Post comments count0
Post likes count0

PowerTip: Finding Letters in Strings with PowerShell

Doctor Scripto

Summary: Learn four ways to use Windows PowerShell to find letters in strings.  I want to find out if a string contains the letter “m.” The string is stored in the variable $a as shown here: $a=”northern hairy-nosed wombat”  Here are a variety of ways to accomplish this: a.  [string]$a.contains(&ldqu...

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

PowerTip: Create a Strongly Typed Array in PowerShell

Doctor Scripto

Summary: Learn how to create a strongly typed array.    I want to create a strongly typed array of system.diagnostics.processes and store it in a variable called $a. How can I do this?  Use a command such as: [diagnostics.process[]]$a=get-process

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

PowerTip: Find the Length of PowerShell Aliases

Doctor Scripto

Summary: See how to determine the distribution of Windows PowerShell cmdlet aliases by length.  How many Windows PowerShell aliases are 1-letter or 2-letters or 3-letters in length? In fact, how do you determine what the entire distribution of cmdlet alias lengths is?  Use the Get-Alias cmdlet to retrieve all of the aliases. The...

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

PowerTip: Creating an Empty Hash Table

Doctor Scripto

Summary:  Learn to create a Windows PowerShell hash table.  How can I create an empty hash table?  Use @{} and assign it to a variable:             $hash = @{}

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

PowerTip: Displaying the value of pi

Doctor Scripto

Summary: Learn to obtain the value of pi.  How can I obtain the value of pi? a. [math]::pi b. 22/7

Scripting Guy!Windows PowerShellPowerTip