Category Archives: Powershell

ADO .NET, Export-CSV, required column names (headers)

PowerShell has a very nice cmd-let called Export-CSV. It allows to serialize any .NET object to a csv file. The cmd-let has a heavy usage when you need to export a sql table to a csv file, i.e. an instance … Continue reading

Posted in .NET, ADO .NET, Powershell | 1 Comment

Keep inner script variables in an outer scope (dotsource)

If you would to access script variables, created while executing the script, from an outer scope, for example a powershell console session, you need to invoke the script with an additional dot and whitespace before its path: powershell> . .\MyScript.ps1

Posted in Powershell | Leave a comment

Out-Null

Out-Null accepts input and just discards it. For example, nothing will be at a console window. The cmdlet does not discard exceptions in the pipeline

Posted in Powershell | Leave a comment

Powershell Version

If you would like to find out the current Powershell version, use a predefined variable $Host which exposes a ‘Version’ property of type System.Version > $Host.Version

Posted in Powershell | Leave a comment