Blog posts tagged - "142"

Slides from my powershell talk

I gave an introduction to Powershell talk at the St. Louis .Net UG meeting on Monday, October 29th to about 70-80 people or so. I introduced basic concepts of powershell, talked about a few problems I had solved with it, and showed some simple scripts. At the end of the presentation, I promised to post the slides by the end of this week, and I’m making it Wednesday night. Believe me when I say that me getting something finished early is a minor miracle 🙂
Continue reading -->

Finding installed products with uninstall instructions

I was repaving a machine the other day, and I had to load all my development tools. There were a bunch of them, and when I got finished, I noticed that IIS and SQL Server failed to install properly. So I uninstalled IIS and reinstalled it, no problem. SQL Server was another story. I uninstalled it, and it only went part way. Then I tried to reinstall it, and it said it was already installed.
Continue reading -->

Another powershell quickie – removing all bin and obj directories beneath VS.Net projects

gci -recurse -include bin,obj . | ri -recurse I was playing around with how to get this to work, and I couldn’t seem to figure out why these commands didn’t find the same locations to delete: gci -recurse -include bin,obj . ri -recurse -force -include bin,obj -whatif . I finally got so baffled that I RTFMed remove-item, and there was my answer. In the fine print, nestled away in an example that did what I was looking for, and in the documentation for the recurse parameter was my answer…
Continue reading -->

find -name foo.* | xargs grep “find_me”

[Update from Brad Wilson and Scott Dukes] I’ve been wanting a powershell script to replace my favorite unix command for ages, and I took a stab at it today. This got me very close to what I wanted yesterday, which was just the names of files where the matches occurred. get-childitem -include foo.* -recurse | where-object { get-content $_ | select-string find_me } Scott Dukes pointed out that select-string would take the FileInfo object that was passed to it and search through the contents for the string file_me, and this would give me the exact same kind of output my unix command used to.
Continue reading -->