Splatting with $PSBoundParameters and Default Values for Optional Parameters

Splatting is a really great feature in PowerShell that lets you take a hash of parameters and call a function or cmdlet with the hash instead of having to type out every parameter name and value. It seems natural then that if you’re writing a wrapper or proxy function, where your function takes the same or nearly the same parameters as the function you’re calling, you could use $PSBoundParameters to do the heavy lifting (this special variable contains all of the parameter values passed into the function).

The problem comes when your proxy function has defaults for its optional parameters. $PSBoundParameters only includes the values of parameters that were explicitly supplied by the caller. There is no such variable that contains the default values.

[Continue reading]

DNS Manager Can’t Set TXT Record to Expire

I finally got DNS scavenging configured in our environment. It’s working great, no big disasters. I was browsing the DNS manager (so much faster now that we got rid of those 6,000+ resource records we didn’t need) and I noticed 2 TXT records that I created as a test last week. I didn’t need them anymore, but instead of deleting them I thought I’d just set them to expire and let scavenging take care of it. Funny thing is, the setting just wouldn’t stick. No errors, nothing preventing me from doing it, it just kept reverting to static.

[Continue reading]

Get-DnsServerResourceRecord returns duplicate records when a sub-domain matching the zone exists

While writing a PowerShell script to fix some DNS records, I came across some very strange behavior. I was calling [cci theme="default" lang="powershell"]Get-DnsServerResourceRecord[/cci] and it was returning duplicate results for every record. One … [Continue reading]

Get Progress on DFS Replication Database Cloning Import

DFSR-Import-Progress

As I wrote in a previous post, I began using the new DFS Replication database cloning technique to speed up initial sync. Thanks to Ned Pyle's great How-To on the subject, I was able to tell exactly which events to look for in the event log to get an … [Continue reading]

DFSR Database Cloning Import Fails – 0×00001129 – Error 4393 – The tag present in the reparse point buffer is invalid

Windows 2012 R2 introduces a great feature for speeding up DFS Replication initial sync: Database Cloning. The details are covered very well by Ned Pyle's excellent blog posts, especially this one. Seeing as how this is pretty new stuff, there … [Continue reading]

Remote Desktop Gateway Server is Temporarily Unavailable on SBS 2011 After Uninstalling Exchange Server

There are several causes of the error "Your computer can't connect to the remote computer because the remote desktop gateway server is temporarily unavailable" in Windows SBS 2011. There are a lot of articles that deal with the specifics so I'll go … [Continue reading]