Skip to content
Archive of posts filed under the Scripts category.

A Remoting Issue with PowerShell 3 Beta

I’ve been doing some thinking about PowerShell Remoting for a project at work and realized that I hadn’t ever set up remoting on my “home” laptop. I’m not in a domain, so remoting configuration is a bit different. In any case, I would be using the same machine as source and target of the remoting [...]

Share

Speeding up Powershell Webcast by Dr. Tobias Weltner

If you’ve done much looking around, you know that there’s an awful lot of great information about PowerShell available on the web. The community that has formed around this product is one of its strengths. You’re probably familiar with the name Tobias Weltner. His Master-PowerShell e-book has long been a resource that I’ve turned to [...]

Share

Importing Modules using -AsCustomObject

I recently got thinking about the -AsCustomObject switch for the Import-Module cmdlet. I have seen it several times in discussions of implementing “classes” in PowerShell. Here’s a typical (i.e. trivial) example: #module adder.psm1 function add-numbers($x,$y){ return $x+$y } With that module, we can do the standard module stuff: PS> import-module adder PS> add-numbers 1 2 [...]

Share

Aggregation In PowerShell (and another pointless function)

I’ve been doing a lot of thinking about “idiomatic PowerShell” since my last post and my thinking led me to an idea that I haven’t actually used, but seems like the kind of thing that people would do in PowerShell. If I were writing a script that needed to get a “bunch of things” from [...]

Share

PowerShell’s Problem with Return

I think that PowerShell is a fairly readable language, once you’re used to its unique features. Naming functions (cmdlets) with an embedded hyphen, using -eq instead of the equals sign (and similarly for other operators) and not using commas to delimit parameters in a function call (but using them in a method call) are all [...]

Share

Verifying Automation

If you’re anything like me, you’ve been bitten by the PowerShell bug and are using it among other automation sources to make you life in IT much more enjoyable. If this is not the case…you need to get started!  There’s no time like the present, and a PowerShell New Year’s resolution should be something to [...]

Share

PowerShell and MongoDB

I recently saw this link on using NoSQL with Windows.  Now, I’m a SQL Server DBA, so I haven’t really had any reason to use NoSQL.  I was curious about how easy it was going to be to set up and if I could get it working with PowerShell. I selected MongoDB from the list [...]

Share

Checking a Field for NULL in PowerShell

It’s been a long time (over 2 months) since I last posted.  I’ll try to get back into a rhythm of posting at least weekly.  Anyway, this is something that occurred to me at work when writing a script. I usually avoid nullable columns, but sometimes date fields make sense to be null (rather than [...]

Share

The PowerShell Bug That Wasn’t, and More Package Management

Have you ever tracked down a bug, been confident that you had found the root of your problems, only to realize shortly afterwords that you missed it completely? What I posted yesterday as a bug in PowerShell (having to do with recursive functions, dot-sourcing, and parameters) seemed during my debugging session to clearly be a [...]

Share

Package Management and a PowerShell Bug

UPDATE: I have worked out how the behavior described at the end of this post is not a bug, but in fact just PowerShell doing what it’s told. Don’t have time to explain right now, but I’ll write something up later today. I also worked out how to “fix” the behavior. For a long time [...]

Share