Showing results for July 2013 - Page 7 of 13 - Scripting Blog [archived]

Jul 16, 2013
Post comments count0
Post likes count0

PowerTip: Use PowerShell to Check String for a Match

Doctor Scripto
Doctor Scripto

Summary: Learn how to check a string to see if it contains another string.  How can I use Windows PowerShell to check a string to see if it contains another string?  Use the –Match operator: PS C:\> $a = [string]"This string contains a number of letters" PS C:\> $a -match 'a number' True

Scripting Guy!Windows PowerShellPowerTip
Jul 16, 2013
Post comments count0
Post likes count0

Query Multiple WMI Classes but Return One Object with PowerShell

Doctor Scripto
Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, shows how to query multiple WMI classes with Windows PowerShell and return a single object.  Hey, Scripting Guy! I have this script that I have been working on for a while. It queries three different WMI classes. The first two classes are no problem because they only return a single item—for i...

Scripting Guy!Windows PowerShellscripting techniques
Jul 15, 2013
Post comments count0
Post likes count0

PowerTip: Find PowerShell Cmdlets that Accept Hash Table Input

Doctor Scripto
Doctor Scripto

Summary: Find Windows PowerShell cmdlets that accept a hash table for input.  How can I find what Windows PowerShell cmdlets accept a hash table for input?  Use the Get-Command cmdlet, use the ParameterName parameter, and search for HashTable information: Get-Command -ParameterName *hashtable* 

Scripting Guy!Windows PowerShellPowerTip
Jul 15, 2013
Post comments count0
Post likes count0

Use PowerShell and a Filter Hash Table to Speed Boot Trace

Doctor Scripto
Doctor Scripto

Summary: Microsoft Scripting Guy, Ed Wilson, talks about using a filter hash table with Windows PowerShell to speed up boot trace parsing.  Hey, Scripting Guy! I don’t get it. You wrote a script yesterday, and said that the performance was bad. You suggested that you could improve the performance, but then you did not do anything about i...

Scripting Guy!Windows PowerShellscripting techniques
Jul 14, 2013
Post comments count3
Post likes count1

PowerTip: Find the Largest Number in a PowerShell Array

Doctor Scripto
Doctor Scripto

Summary: Easily find the largest number in a Windows PowerShell array.  How can I use Windows PowerShell to easily find the largest number in an array of numbers?  Pipe the array to the Measure-Object cmdlet, and use the –Maximum switch: PS C:\> $a = [array]1,2,5,6,3,2,9,1 PS C:\> $a | measure -Maximum &nbs...

Scripting Guy!Windows PowerShellPowerTip