Test for Verbose in Powershell

I was looking for a way to determine whether I was in Verbose mode in Powershell. My web searches came up with various solutions that all suffer from problems. Most of them use $PSBoundParameters. The most obvious problem with this is that it only works when -Verbose was called directly on the script or function whose context you’re currently in. Since the Verbose state is inherited by child scopes, this is less than ideal.
[Continue reading]

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 … [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


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 – 0x00001129 – 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]