Category: Windows

  • Install sqlps as a PowerShell module

    Most of SQL Server automation scripts using PowerShell use SMO directly. For example, one would do something like: [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SqlServer.SMO”) $MyServer = new-object (‘Microsoft.SqlServer.Management.Smo.Server’) ‘HOME’ $MyDataBase = new-object (‘Microsoft.SqlServer.Management.Smo.Database’) ($Server, “MyDataBase”) That’s a lot of typing and looks messy and cumbersome. Since SQL Server 2008, Microsoft provides a sqlps shell which exposes a lot of SQL […]

  • Cliffs Notes: administrating Active Directory with PowerShell

    1. Install ActiveDirectory modules by running PowerShell as Administrator and executing the commands below: [code language=”text”] PS C:\Windows\system32> Import-Module ServerManager PS C:\Windows\system32> Add-WindowsFeature RSAT-AD-PowerShell Success Restart Needed Exit Code Feature Result ——- ————– ——— ————– True No Success {Active Directory module for Windows Power… [/code] 2. Link for newly added Active Directory cmdlets after installation, […]

  • PowerShell TDD with PSUnit: some usage examples

    I discussed setting up PSUnit for unit testing PowerShell before. This is a quick followup for my own record and consumption in the future. I will update this post as I find more interesting things to record. 1. Put PowerShell functions in one file such as myBaseFunctions.ps1; 2. Create a test directory and under that […]

  • Installing ack on Windows with ActiveState Perl

    Search is important! Having a good tool for text search can lower or eliminate barrier, speed up work, and generally make life more enjoyable and fulfilling. That handy search tool, for me on Linux, has been ack for the past few years. One still needs to know some grep and regex. In fact, the more […]

  • PowerShell TDD with PSUnit

    My own Cliffs Notes on PowerShell unit testing. Hope it helps you as well. I may update this as I move along. 1. For serious, robust programming, TDD is definitely the way to go; 2. I looked at both Pester and PSUnit. Despite the 10 votes (so far) for the Pester answer on a stackoverflow […]