Hello PowerShell world!
May 12, 2006
Why yet another blog?
I'm excited by the potential of Windows PowerShell for professional administrators and power users to get a handle on their Windows computers and plan to use this blog to describe, explore, comment and pontificate about any issue relating to Windows PowerShell that interests or puzzles me.
And, of course, I plan to post and discuss some PowerShell scripts that hopefully will be useful to people who are learning about Windows PowerShell and learning how to use it.
PowerShell is different in many significant ways from other command line shells and scripting languages. So I ought to have plenty to write about over the coming months.
May 12, 2006 at 12:52 pm
I’m looking forward to hearing about your experiences with PowerShell.
Cheers!
Jeffrey Snover
November 22, 2006 at 6:23 pm
In a search and replace substring script involving multiple files, I have concurrency issues. Here’s the script:
(get-childitem . -recurse -force -include “Root”) |
foreach-object -process
{get-content $_ |
select-string -pattern 2001 |
foreach-object {$_ -replace “2001″, “2003″} |
set-content $_
}
The intent is to search the folders recursively to
find files named “Root”. For each found file,
get the single line out and replace the occurence
of the string “2001″ with “2003″.
Finally, write out the content back to the same file.
An example (Example 3) of a similar operation is given
in “get-help set-content -detailed”.
Instead, I get “… because it is being used by another process …”.
Is there a better way?