#PowerShell: Splatting a Local Hash Table in a Remote Session

I'm sure that most people who use PowerShell on a regular basis are familiar with the "Using" variable scope modifier which allows for the use of local variables in a remote session. This functionality was introduced with PowerShell version 3:A fairly simple concept, right? But wait a minute, did you know that you can also define a local hash table to be used with splatting in a remote session using this same concept?The Read more [...]
Posted in PowerShell | Tagged | 1 Comment

My Solution: August 2015 PowerShell Scripting Games Puzzle

A couple of months ago, PowerShell.org announced that the PowerShell Scripting Games had been re-imagined as a monthly puzzle. In August, the second puzzle was published. The instructions stated that a one-liner could be used if you were using a newer version of PowerShell. A public JSON endpoint can be found at http://www.telize.com/geoip and your goal is to write some PowerShell code to display output similar to the following:Try to accomplish this with a Read more [...]
Posted in PowerShell, Scripting Games | Tagged , | Leave a comment

Video from Atlanta TechStravaganza 2015: Using PowerShell Desired State Configuration in your On-Premises Datacenter

This past Friday, I presented a session titled "Using PowerShell Desired State Configuration in your On-Premises Datacenter" at Atlanta TechStravaganza 2015. Fellow PowerShell MVP Stephen Owen took this photo as I was preparing for my session: Another fellow PowerShell MVP, Jonathan Walz of the PowerScripting Podcast, recorded all of the sessions in the PowerShell track which can be found on their YouTube channel. Several presentations are included in each of the videos and mine is Read more [...]
Posted in Desired State Configuration, PowerShell | Tagged , , | Leave a comment

Remove App Packages from Windows 10 Enterprise Edition

So you've installed Windows 10 enterprise edition only to find applications that you would consider to be consumer type apps such as Bing Finance, News, and Sports which is not what you would normally expect to find in an enterprise edition operating system version: You can obtain a list of these app packages for the current user with the Get-AppxPackage PowerShell cmdlet. I've sorted the list of app packages by name in the following results:I've determined Read more [...]
Posted in PowerShell, Windows 10 | 1 Comment

DSC session at Atlanta TechStravaganza one week from today!

Have you seen the awesome lineup of speakers and sessions for Atlanta TechStravaganza this year? Mark Minasi is the keynote speaker and there's an all day dedicated PowerShell track where Ed (The Scripting Guy) Wilson will be presenting along with several PowerShell MVP's including Stephen Owen, and me (of course). My presentation is on "Using PowerShell Desired State Configuration in your On-Premises Datacenter" and I'll share the initial slide of my slide deck that I created exclusively for Read more [...]
Posted in Desired State Configuration, PowerShell | Tagged , , | Leave a comment

Change a Machine’s Subnet Mask with PowerShell Version 2

I recently worked on a project that required me to change the subnet mask on multiple servers at a remote location. The main problem was that many of the servers were still running PowerShell version 2, but luckily PowerShell remoting was enabled on all of them.This script takes into account multiple network cards and multiple IP addresses being assigned to the same network card. I discovered that the array needed to be reversed in order to assign the primary IP Read more [...]
Posted in PowerShell | Tagged | 1 Comment

My Solution: July 2015 PowerShell Scripting Games Puzzle

Last month, PowerShell.org announced that the PowerShell Scripting Games had been re-imagined as a monthly puzzle and the first puzzle was published. The instructions stated to use a PowerShell one-liner that produces the following output. No more than one semicolon should be used, do not use the ForEach-Object cmdlet or one of its aliases. The one-liner should be able to target more than one computer and feel free to go crazy with a really short one-liner with aliases and whatever else.Although Read more [...]
Posted in PowerShell, Scripting Games | Tagged , | 2 Comments

Using PowerShell for Remote Server Administration in Windows 10 RTM without the RSAT tools

You've updated to the RTM version of Windows 10 only to learn that the remote server administration tools aren't available as of yet:Let's say for example the Active Directory PowerShell module is something that you use on a daily basis and it's necessary to perform your day to day responsibilities. Well, you're out of luck because the RSAT tools aren't available yet, but before you consider using RDP or the GUI to perform your duties, let's take a look at Read more [...]
Posted in PowerShell | Tagged , | 7 Comments

Presentation Materials from my sessions at SQL Saturday 423 in Baton Rouge

This past Saturday, I presented two sessions at SQL Saturday #423 in Baton Rouge. The code and slides that I used during my "PS C:\> Get-Started -With 'PowerShell for SQL Server'" presentation can be downloaded from here and the code and slides from my "PS C:\> Get-Started -With 'PowerShell Desired State Configuration'" presentation can be downloaded from here. The code from both sessions reference PowerShell functions that are part of script modules that can be downloaded from my Read more [...]
Posted in Desired State Configuration, PowerShell, SQL Server | Tagged , , , | Leave a comment

Use caution when updating to Windows 10 RTM with data deduplication enabled volumes

I recently decided to reload my computer, moving from Windows 8.1 Enterprise Edition to Windows 10 Enterprise Edition. I had previously enabled the data deduplication feature on my Windows 8.1 installation with an unsupported hack by using the source files from Server 2012 R2. Deduplication was enabled on my SSD drive for the VHDX files that I use for my test and demonstration environment that runs via Hyper-V VM's. In my opinion, Microsoft should support data deduplication on enterprise edition Read more [...]
Posted in Hyper-V | Tagged , , | 4 Comments

The PowerShell return keyword

The return keyword is probably the most over used keyword in PowerShell that’s used in unnecessary scenarios. You’ll often find it used to simply return the output of a function:In that scenario, using the return keyword is totally unnecessary. If you do want to return the value of the variable, simply let PowerShell take care of returning the output:I received a comment on Twitter from Bill Hurt about using the Write-Output cmdlet Read more [...]
Posted in PowerShell | Tagged | 2 Comments

Determine who deleted SQL Server database records by querying the transaction log with PowerShell

Have you ever had a scenario where records from one or more SQL server database tables mysteriously came up missing and no one owned up to deleting them? Maybe it was an honest mistake or maybe a scheduled job deleted them. How do you figure out what happened without spending thousands of dollars on a third party product? You need to determine what happened so this doesn't occur again, but the immediate crisis is to get those records back from a restored copy of the database. How do you determine Read more [...]
Posted in PowerShell, SQL Server | Tagged , | 1 Comment