Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » Powershell   (RSS)
Sorry, but there are no more tags available to filter with.

Changing text encodings of output files redirected from PowerShell.

I created a logman setting file as follows: typeperf -q | where { $_ -like "\Phy*" } | foreach { '"' + $_.Trim() + '"' } > counter.txt But, logman raised an error reading “Invalid counter path” when I tried to update a counter data collection with
Posted by yjhong | 1 Comments
Filed under:

Passing arguments from the command line to downstream functions in Powershell

$args is a special variable, an array of all arguments passed to a function on the command line. But, $args is always treated as an array in PowerShell. And It may cause an interesting side effect when passing $args to a downstream function. Suppose we
Posted by yjhong | 2 Comments
Filed under:

How to create a function name to the global scope in a Powershell script file

I created a script named s.ps1 to define a function named s1. # s.ps1 function s1 { // } But, after I run this script, the s1 function is not available in the global scope like: .\S.ps1 S1 s1' is not recognized as a cmdlet, function, operable program,
Posted by yjhong | 3 Comments
Filed under:

How to create multiple or jagged arrays in Powershell

For me, it was not apparent to create multiple dimensional or jagged arrays in Powershell. I tried the following command, but it only made a single dimensional array: $b = ((‘a’,’a’)) $b.Count 2 Bruce Payette gave me the answers for this basic question.
Posted by yjhong | 2 Comments
Filed under:
 
Page view tracker