Browse by Tags

All Tags » PowerShell (RSS)

PowerShell: Return values from a function through reference parameters

PowerShell has a special [ref] keyword to specify which parameters are used in a fuction to return values. It's usage is not directly clear however. If the type of the variable to update is a value type, use the [ref] keyword in the declaration of the...
Posted by svdoever | 3 comment(s)
Filed under: ,

Documenting PowerShell script code

The Macaw Solutions Factory contains a lot of PowerShell script code. A lot of the code is documented, but it is not documented in a consistent way because there were no documentation standards available for PowerShell 1.0, we only had the very complex...
Posted by svdoever | with no comments
Filed under:

Powershell output capturing and text wrapping: strange quirks... solved!

Summary To capture (transcript) all output of a Powershell script, and control the way textwrapping is done, use the following approach from for exmaple a batch file or your Powershell code: PowerShell -Command  "`$host.UI.RawUI.BufferSize ...
Posted by svdoever | 8 comment(s)
Filed under:

Powershell: Generate simple XML from text, useful for CruiseControl.Net merge files

I had the problem that I need to include ordinary text files into the CruiseControl.Net build output log file. This log file is a merge of multiple files in xml format. So I needed to get some text files into a simple xml format. I ended up with the following...
Posted by svdoever | 2 comment(s)
Filed under:

Post to self: getting the directory where the CLR is installed in PowerShell

[System.Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory()   will return a path like: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
Posted by svdoever | 2 comment(s)
Filed under:

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: ,

Edit file in Wss3 web application with SharePoint Designer blows up your web site

I wanted to create a simple html file in the root of my Wss3 web application, so I created an empty file test.htm. I double clicked te file and because I have SharePoint Designer installed, it is the default editor for .htm files. I put some test into...
Posted by svdoever | 11 comment(s)
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 | 17 comment(s)
Filed under: , ,

PowerShell Exception handling using "Trap" explained - links

PowerShell has powerful exception handling, but it is badly documented and takes while to understand what the heck they actually want to do to wire up the exception handling. I'm normally not such a link poster, this is more of a "post-to-self" item that...
Posted by svdoever | 1 comment(s)
Filed under:

Powershell: Is a SharePoint solution installed or deployed?

I was having some fun with PowerShell to talks against the SharePoint object model. I needed to know if a SharePoint solution was installed and if it was deployed. I got to the code below. Might be handy for someone to see how easy it is to get info out...
Posted by svdoever | with no comments
Filed under: ,
More Posts Next page »