Browse by Tags

All Tags » .NET » PowerShell (RSS)

C:\Program Files\Reference Assemblies for assemblies to reference in your code

I just stumbles across a "new" concept of Microsoft. In the C:\Program Files\Reference Assemblies folder Microsoft installs assemblies for products that can be referenced from your code. Instead of referencing assemblies directly from the GAC...
Posted by svdoever | with no comments
Filed under: ,

SharePoint stsadm.exe and the infamous "Command line error"

The SharePoint command-line utility stsadm.exe was driving me crazy for the last two days. I'm automating all kind of this from PowerShell scripts, but I got the error "Command line error" while I was absolutely sure that what I was doing was correct...
Posted by svdoever | 8 comment(s)
Filed under: , ,

Generate a list of GUID's

Sometimes you just need a lot of GUID's while programming. Ofcourse you could use the Visual Studio GUID tool, bu that is a lot of work. Open a PowerShell console, and paste in the following line to get a list of 100 guid's: $i=100; while ($i-- -gt 0...
Posted by svdoever | 4 comment(s)
Filed under: ,

Factories @ Macaw - the DotNed presentation of april 26, 2007

On april 26, 2007 I gave a presentation at the Macaw headquarters in Schiphol-Rijk, The Netherlands on what we are doing with Software Factories at Macaw. I promised the audience to publish some links to tools and information mentioned in the presentation...

A templating engine using PowerShell expressions

[Update Januari 5, 2008: fixed a small bug, content was always saved in encoding ANSI, resulting in the loss of special characters. Changed the line: Set-Content -Path $destination -value $expandedText to Set-Content -Path $destination -value $expandedText...
Posted by svdoever | 3 comment(s)
Filed under: , ,

PowerShell pitfalls: reading text from file using get-content

I had a really strange effect in PowerShell that puzzled me for hours! I have the following script: $a = @' One Two '@ $a $p = [regex]"One" $p.Replace($a, "OneReplaced") $b = get-content -path templ.txt $b $q = [regex]"One" $q.Replace($b, "OneReplaced...
Posted by svdoever | 5 comment(s)
Filed under: ,

PowerShell: calculating a relative path

Sometimes you need a simple thing like calculating the relative path of a file given its full path and a base path. For example you have a file c:\a\b\c\d\e.doc and a base path c:\a\b\c, the relative path is now d\e.doc. I use the following PowerShell...
Posted by svdoever | 3 comment(s)
Filed under: ,

PowerShell and debugging

I still did not found a good debugging environment for my PowerShell development. The thing I use most is a command I found in this blog post , part of a great blog post series on PowerShell debugging on the Windows PowerShell blog by the PowerShell team...
Posted by svdoever | with no comments
Filed under: ,

PowerShell and using .Net enum types

[NOTE: Because this page is the first hit in Google when you search on Powershell + enum, and I landed on this page too often myself, I decided to expand the page with some additional information] Scripting is heaven when you can utilize the complete...
Posted by svdoever | 4 comment(s)
Filed under: ,

PowerShell: $null and parameter type

One of those things that can take you ages to find out: I create a function where a parameters that can either have a string value or can be $null: function doit { param ( [string]$a = $( throw "Missing: parameter a"), $b = $( throw "Missing: parameter...
Posted by svdoever | 5 comment(s)
Filed under: ,
More Posts Next page »