Posts


Moving my Enterprise Grade Network Equipment to a New Home

My family has been out of town this week. Light bulb moment! It’s the perfect time to cut holes in sheetrock and drill holes in ceilings to install my home network gear. When we moved a couple of months ago, I literally threw the network equipment in a closet. I used the same equipment from my previous home except for a new cable modem. Specifically, the Motorola MB8600 which is gigabit capable since I now have gigabit Internet service.

Video: Automatically Migrate your Scripts from AzureRM to the Az PowerShell Module

As many of you know, I’m a Senior Content Developer for Azure PowerShell at Microsoft. Today we announced the Az.Tools.Migration PowerShell module which is a toolkit for automatically migrating your PowerShell scripts and modules from AzureRM to the Az PowerShell module. The video shown below demonstrates how to use this module: Be sure to see the official announcement that I wrote on the Microsoft Tech Community blog site. In addition to the PowerShell module, there is also a VS Code extension for performing the migration.

Default to Device Authentication when Connecting to Azure with Windows PowerShell

Windows 10 Enterprise edition version 2004 is used for the scenarios demonstrated in this blog article. If you’d like to follow along, you’ll also need to install PowerShell version 7 and the Az PowerShell module. As stated in the help for Connect-AzAccount, the UseDeviceAuthentication parameter is the default authentication type for PowerShell version 6 and higher. help Connect-AzAccount -Parameter UseDeviceAuthentication What this means is that you’re provided with a URL and a code.

I’m joining Microsoft and today is my last day as a Microsoft MVP

I’ve worked as an IT Pro since 1994, with the past fourteen years at the same employer and my last day with them was this past Friday. I’ve also been a Microsoft MVP for the past six years, the first two as a PowerShell MVP and the last four as a Cloud and Datacenter Management MVP. Today is my last day as a Microsoft MVP because you can’t be an MVP if you work for Microsoft.

How many Services does Microsoft Azure Offer?

I’ve recently wondered how many service offerings Azure has. I’ve read anywhere from 150 to 600 and I even went so far as to ask an Azure Product Manager but still didn’t receive a clear answer. What I did find out is that Microsoft maintains an Azure services directory on their Azure products website. I figured that was a good place to start looking and while the website is informative, it didn’t provide a count of the service offerings.

AzureRM PowerShell Commands that Don’t Exist when Enabling Compatibility Aliases in the Az Module

As I mentioned in a previous blog article, the AzureRM PowerShell module is only supported until December of 2020. It has been replaced by the Az PowerShell module which was introduced in December of 2018. On Twitter, I recently asked if anyone was still using the AzureRM module and what was keeping them from transitioning to the Az module. One of the responses I received was due to the amount of work and time invested in scripts based on the AzureRM module.

How to Install the Azure Az PowerShell Module

The Az PowerShell module was released in December of 2018 and is now the recommended module for managing Microsoft Azure. AzureRM is the previous PowerShell module for managing Azure which has been deprecated but will continue to be supported until December of 2020. Windows PowerShell 5.1, PowerShell Core 6, PowerShell 7, and higher are supported by the Az PowerShell module. Windows 10 version 1607 and higher has Windows PowerShell 5.1 installed by default.

30 Must-Follow Small Business IT Influencers

Back on November 25th of 2019, I made the list of one of the 30 Must-Follow Small Business IT Influencers. Here’s what their website had to say about me: µ

Setting Dependencies on the Azure PowerShell Module

I recently saw a tweet from Joel Bennett about the Az (Azure) PowerShell module being nothing more than an empty module that imports all of the modules for each Azure product. I decided to investigate. Get-Content -Path (Get-Module -Name az).Path | Select-String -SimpleMatch 'Import-Module' Joel’s statement is 100% accurate. Off-Topic: The searched for term is highlighted in each result when the previous command is run in PowerShell 7.

Initial Setup of a CanaKit Raspberry Pi 4 4GB Starter Kit

For Christmas, I received a CanaKit Raspberry Pi 4 4GB Starter Kit with Clear Case (4GB RAM). The kit contains everything you need minus an HDMI monitor and USB keyboard/mouse. It includes the Raspberry Pi 4b (I received the one with 4GB of RAM, but it’s also available with 1GB or 2GB of RAM), heatsinks, a power supply with a removable inline switch, case (I ordered the one with a clear case), case fan, micro HDMI to HDMI cable, micro SD card with NOOBS preinstalled (I ordered the one with a 32GB card), and a USB micro SD card reader in case you need to reload NOOBS on the SD card.

Using PowerShell to Retrieve Exchange Mailbox Statistics for Office 365 Migrations

Recently, I’ve been working on trying to finish up a migration from Exchange Server 2010 to Office 365. There are potentially numerous mailboxes that aren’t used and those won’t be migrated to Office 365 because there’s no sense in paying for licensing for them. How do you determine what mailboxes are in use? First, use implicit remoting to load the Exchange cmdlets locally. Years ago, I would install the Exchange cmdlets locally, but it was brought to my attention that it’s unsupported, at least according to this article: Directly Loading Exchange 2010 or 2013 SnapIn Is Not Supported.

PowerShell + DevOps Global Summit 2020 – Call for Speakers

The call for speakers for the 2020 PowerShell + DevOps Global Summit is open until October 1st. I can definitely speak from experience when I say that this is the best PowerShell conference in North America if you’re interested in PowerShell and networking with other like-minded people. I’ve attended every year since its inception and have spoken at it about half as many times. While I’m in no way affiliated with the organizers, based on their site, they’re not only looking for deep-dive content but also intermediate sessions.

PowerShell Productivity Hacks: How I use Get-Command

If you’ve been using PowerShell for very long at all, then you should already be familiar with Get-Command and Get-Help. While I like to say that Get-Command is for finding commands and Get-Help is for learning how to use those commands once you’ve found them, there is overlap between these two commands depending on how you use them. I believe in following the best practice of not using aliases or positional parameters in any code that I save or share with others, but in this blog article, I’m going to show how things work in the real world.

Research Triangle PowerShell Saturday – September 21st

The Research Triangle PowerShell Saturday is Saturday, September 21st, 2019 in Raleigh, North Carolina. There’s also a 6-hour security session on Sunday, September 22nd, 2019. Tickets can be purchased for just one of the days or both, but seating is limited for the Sunday post-con so don’t wait until the last minute! Based on the schedule, this event should be almost like a mini PowerShell + DevOps Global Summit which makes it well worth the price of admission.

Parallel and ThrottleLimit Parameters added to ForEach-Object in PowerShell 7 Preview 3

Preview 3 of PowerShell 7 was released yesterday. It can be downloaded from the PowerShell repository on GitHub. Be sure to choose the preview version for the appropriate operating system. It should go without saying that anything with preview in its name should NOT be installed on a mission-critical production system. The examples shown in this blog article are being run on a system running Windows 10 (x64). Your mileage may vary with other operating systems and/or versions.

Presenting 2 Sessions in the All Day Dedicated PowerShell Track at SQL Saturday Baton Rouge this Saturday August 17th, 2019

I’ll be presenting PowerShell + SQL Server = Better Together and Writing Award Winning PowerShell Functions and Script Modules at SQL Saturday #867 in Baton Rouge Louisiana this Saturday, August 17th. The event is free, although you need to register. Here’s a little information about what you can expect from my sessions: PowerShell + SQL Server = Better Together As a SQL Server professional, are you able to make a rhyme or reason to this thing called PowerShell?

PowerShell Function to Find Parameter Aliases

While sitting through Jeff Hicks' Advanced PowerShell Scripting Workshop at PowerShell on the River in Chattanooga today, he mentioned there being a “Cn” alias for the ComputerName parameter of commands in PowerShell. I’ve previously written a one-liner to find parameter aliases and at one time Microsoft had starting adding parameter aliases to the help for commands as referenced in that same blog article, but it appears that they’ve discontinued adding them to the help and removed the ones they previously added to it.

Where are Untitled Tabs in VSCode Saved on a Windows System?

Ever wonder how VSCode (Visual Studio Code) maintains those untitled tabs between sessions? They’re stored as files underneath your user’s profile in appdata on Windows based systems as shown in the following example. Get-ChildItem -Path $env:APPDATA\Code\Backups\*\untitled -Recurse The previous command could be piped to Get-Content to view the contents of all of code in the open untitled tabs of VSCode. You could also use Select-String to find something specific. I can see that three of my open tabs contain ‘mikefrobbins’.

The No-Nonsense Beginner’s Guide to PowerShell at PowerShell on the River in Chattanooga, TN on Saturday August 10th

I’ll be presenting “PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell” at PowerShell on the River in Chattanooga Tennessee this Saturday, August 10th. The event itself is a mini-conference with all day sessions on Friday, August 9th and then numerous speakers presenting in three different tracks on Saturday, August 10th. Here’s a little information about what you can expect from my session: PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell

What’s in your PowerShell $PSDefaultParameterValues Preference Variable?

The $PSDefaultParameterValues preference variable, which was introduced in Windows PowerShell version 3.0, provides a mechanism for specifying default values for parameters. I thought I would share what I’ve added to mine and ask the community to share theirs. $PSDefaultParameterValues = @{ 'Out-Default:OutVariable' = 'LastResult' 'Out-File:Encoding' = 'utf8' 'Export-Csv:NoTypeInformation' = $true 'ConvertTo-Csv:NoTypeInformation' = $true 'Receive-Job:Keep' = $true 'Install-Module:AllowClobber' = $true 'Install-Module:Force' = $true 'Install-Module:SkipPublisherCheck' = $true } The first one in the list ('Out-Default:OutVariable' = 'LastResult') is one I picked up from Joel Bennett to store the results of the last command in a variable named $LastResult.

PowerShell + SQL Server = Better Together Presentation at SQL Saturday Birmingham on Saturday, July 27th

I’ll be presenting PowerShell + SQL Server = Better Together at SQL Saturday #899 in Birmingham Alabama this Saturday, July 27th. The event is free, although you need to register (some SQL Saturday’s charge a small optional fee for lunch). Here’s a little information about what you can expect from my session: PowerShell + SQL Server = Better Together As a SQL Server professional, are you able to make a rhyme or reason to this thing called PowerShell?

Install PowerShell 7 with Jeff Hicks’ PSReleaseTools Module

PowerShell version 7 is currently in preview and while it can be installed on Windows, Linux, and macOS, the examples shown in this blog article focus on installing it on a Windows based system, specifically Windows 10 using Windows PowerShell version 5 or higher which ships by default with Windows 10. Your mileage may vary with other operating systems, other versions of Windows, and/or other versions of Windows PowerShell. The easiest way that I’ve found to install the preview of PowerShell version 7 is to first install Jeff Hicks' PSReleaseTools PowerShell module from the PowerShell Gallery using Windows PowerShell.

Import a Hyper-V Virtual Machine with PowerShell

I recently ran into a problem where an exported VM from Windows Server 2016 running Hyper-V wasn’t able to be imported on Windows Server 2019 running Hyper-V. When attempting to perform the import, the GUI stated “No virtual machines files found” as shown in the following image. This problem may have been due to using Hyper-V manager on a remote system running Windows Server 2012 R2, although the same system was used for the export.

Determine the Generation of a Hyper-V VM with PowerShell

Ever need to determine what generation all of the virtual machines are on your Hyper-V servers? This is simple using the Get-VM command that installs as part of the Hyper-V module for Windows PowerShell. Get-WindowsOptionalFeature -FeatureName *hyper*powershell -Online While the previous command will work on both clients and servers, the following command could also be used on a Windows server. Get-WindowsFeature -Name *hyper*powershell The generation of the VM is one of the properties from the results of Get-VM.

Mitigating BlueKeep with PowerShell

When it comes to security, most people normally approach it at one extreme or the other. Some people do nothing and don’t worry about it. All I can say for those folks is good luck with that and I hope your resume is updated. Others go into full blown panic mode, especially those who don’t take the time to understand vulnerabilities. Many security folks and articles on the Internet don’t help much either because they often blow things out of proportion which puts many of the people in the second category into panic mode.

Find an Application that runs as a Service in your Environment with PowerShell

I recently worked with a vendor to remove an old application that was no longer being used from a server in one of my customer’s environments. While many applications may be left to die on the server long after they’re needed, this particular one transmitted data to a partner company so it definitely needed to be removed. The problem is the application was so old that no one knew which server of the hundreds of servers it was running on.

Video: Finding Performance Bottlenecks of Windows Based Systems with PowerShell

Earlier this month, I presented a session on Finding Performance Bottlenecks with PowerShell at the PowerShell + DevOps Global Summit 2019 in Bellevue, Washington. The session seemed to be well received by the audience based on the feedback that I received from the attendees. The video from this presentation is now available. The code and slides used during the demonstration can be found in my presentations repository on GitHub.

Using the AST to Find Module Dependencies in PowerShell Functions and Scripts

Earlier this week, Chris Gardner presented a session on Managing dependencies in PowerShell for the Mississippi PowerShell User Group. I mentioned that I had written a function to retrieve PowerShell module dependencies that’s part of my ModuleBuildTools module. Get-MrAST is one of the primary functions that numerous other functions in the module are built on. #Requires -Version 3.0 function Get-MrAst { <# .SYNOPSISExplores the Abstract Syntax Tree (AST). .DESCRIPTIONGet-MrAST is an advanced function that provides a mechanism for exploring the Abstract Syntax Tree (AST).

Sort PowerShell Results in both Ascending and Descending Order

A few weeks ago I was trying to figure out how to sort something in PowerShell with one property sorted descending and another one ascending. How to accomplish this was hiding in plain sight in the help examples for Sort-Object, but I thought I would documented it here for future reference. Use the Property parameter with a hash table to specify the property names and their sort orders. Get-Service -Name Win* | Sort-Object -Property @{ expression = 'Status' descending = $true }, @{ expression = 'DisplayName' descending = $false } This same command can be written on one line.

Use PowerShell to Identify the Process ID for SQL Server Services

I recently saw a blog article on How to Identify Process ID for SQL Server Services? – Interview Question of the Week #185 written by Pinal Dave. While his answer is simple with TSQL, what if you’re not a SQL guy? You can also retrieve this information with PowerShell from Windows itself. When it comes to retrieving information about Windows services with PowerShell, the first command that comes to mind is Get-Service.

Enable Tab Completion in VSCode for a PowerShell ISE like Experience

I’m using VSCode for all of my PowerShell development at this point. I reloaded my system from scratch on March 13th of this year. Yesterday was the first time I’ve opened the PowerShell ISE since then and it was only to determine if something worked differently between the two (I tweeted this out yesterday). One of the common problems I hear about and have experienced myself with VSCode (Visual Studio Code) is that tabbed expansion of command and parameter names doesn’t work like it does in the ISE (Integrated Scripting Environment).

Run SQL Server PowerShell Cmdlets as a Different User

One of the ways I practice the principal of least privilege is by logging into my computer as a domain user who is also a standard local user. I typically run PowerShell as a domain user who is a local admin and elevate on a per command basis using a domain account with more access only when absolutely necessary. The problem I’ve run into is neither the account I’m logged into my computer as or the one I’m running PowerShell as has the ability to execute SQL queries that I need to run against various SQL servers in my environment.

Audit Membership of the Local Admins Group with PowerShell

Recently, I needed to make sure that specific accounts were members of the local administrators group on several servers along with making sure that no other users were members of it. PowerShell version 5.1 introduced a module named Microsoft.PowerShell.LocalAccounts that contains the following commands for managing local users and groups. Get-Command -Module Microsoft.PowerShell.LocalAccounts Checking the group membership is as easy as running Get-LocalGroupMember within the script block of Invoke-Command and targeting remote systems.

Backup and Synchronize VSCode Settings with a GitHub Gist

Earlier this year, I watched a recording of the January 2019 Arizona PowerShell User Group meeting where Tim Warner presented a session on Easing your transition from the PowerShell ISE to Visual Studio Code. One of the things Tim demonstrated was a VSCode extension named Settings Sync where you can synchronize your VSCode settings to and from a GitHub Gist. While it seems to be designed to synchronize your settings between multiple computers, I recently found out that it can also be a lifesaver even if you only use it on one computer.

The Noobs Guide to Installing Docker Desktop for Windows

I recently came across an article on Running PowerShell Core in a Container. This article tweaked my interest because it was a simple way to run PowerShell in a clean and isolated environment that could be used for testing without the need to spin up an entire VM. It could also be recreated much easier than an entire VM. The examples in the previously referenced article use a command (docker.exe) which I didn’t have on my machine so the first order of business was to figure out how to run Docker on Windows 10.

PowerShell Tokenizer more Accurate than AST in Certain Scenarios

As many of you know, I’ve been working on some module building tools. One of the things I needed was to retrieve a list of PowerShell modules that each function required (a list of dependencies). This seemed simple enough through PowerShell’s AST (Abstract Syntax Tree) as shown in the following example. $File = 'U:\GitHub\PowerShell\MrToolkit\Public\Find-MrModuleUpdate.ps1' $AST = [System.Management.Automation.Language.Parser]::ParseFile($File, [ref]$null, [ref]$null) $AST.ScriptRequirements.RequiredModules.Name The modules that are retrieved by the AST are simply the ones specified in a functions Requires statement.

My Solution to Iron Scripter 2019 Preparatory Challenge 1

Anyone who has competed in the scripting games before knows that I’m always looking for a challenge when it comes to writing PowerShell code. While the scripting games haven’t been held in the last several years, they’ve somewhat been replaced by the Iron Scripter competition at the PowerShell + DevOps Global Summit and 2019 is shaping up to be no different. Think you’ve got skills? Bring them on! and Get-Involved.

Unexpected Results when Comparing Different Datatypes in PowerShell

Earlier this week, I saw a tweet from a fellow PowerShell community member who mentioned PowerShell was returning inaccurate results. The command shown in the tweet was similar to the one in the following example. Get-AppxPackage | Where-Object -Property IsFramework -eq 'False' | Select-Object -Property Name, SignatureKind, IsFramework Why would results be returned where IsFramework is true when the command is filtering them down to only the ones that are false?

What’s a PowerShell One-Liner & NOT a PowerShell One-Liner?

Lately, I’ve seen a few examples of commands that aren’t PowerShell one-liners being passed off as such by people in the PowerShell community who “should” know better. If I were interviewing someone who claimed to be a PowerShell expert with more than five years of experience, I would definitely ask these types of questions. Example 1 - The following command is a PowerShell one-liner? (True or False) $Process = 'notepad.exe'; Start-Process $Process -PassThru -OutVariable NoteProc; Stop-Process -Id $NoteProc.

Return a List of the Private Functions in a PowerShell Module

In my quest to build a PowerShell module to convert a non-monolithic PowerShell module from development to a monolithic one for production, I wanted some way to validate that all of the functions were indeed migrated. While I’m pointing my tools to the public and private sub-folders within my development module and that should get them all, how can you be sure especially when a module may not have any private functions?

Resolving Microsoft SQL Server Error 4064 with PowerShell

Recently, a fellow IT Pro contacted me and stated they were unable to login to one of their SQL Servers using Windows Authentication. The following error was generated when attempting to login to SQL Server Management Studio (SSMS). Their exact words were “I think we have a permissions problem”. Clicking on the “Show technical details” icon at the bottom of that error message showed the following information. You can work around this problem by clicking on the “Options »” button:

Finish the year off helping others in the PowerShell Community

If you follow my blog, then I’m sure you’re aware that earlier this year I embarked on a project to help others get started with PowerShell. I leveraged the contacts I’d made over the years in the PowerShell community and created a book with many of them, named The PowerShell Conference Book with many of them. We all donated our time as 100% of the royalties go towards funding scholarships for the OnRamp track at the PowerShell + DevOps Global Summit.

Book Sale! Save on my PowerShell 101 Book & The PowerShell Conference Book

There’s never been a better time to purchase my PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell eBook. It’s currently on sale for $4.99 using this link which automatically includes a coupon code that’s good from now until the end of the year or for the first 50 redemptions, whichever comes first. Not sure whether or not this book is for you? Download the free sample which includes the first two chapters.

Use PowerShell to Install a DHCP Server on a Windows Server 2019 (Server Core) Active Directory Domain Controller

You need to have an Active Directory domain in place. I’m picking up where I left off in my previous blog article Use PowerShell to Create a New Active Directory Forest on Windows 2019 Server Core Installation (no-GUI). The procedure shown in this blog article is for demonstration purposes only. Install the DHCP server feature. Install-WindowsFeature -Name DHCP Add the DHCP scope to the server. Add-DhcpServerv4Scope -Name '192.168.129.x' -StartRange 192.

Use PowerShell to Create a New Active Directory Forest on Windows 2019 Server Core Installation (no-GUI)

You have a fresh installation of Windows Server 2019 that was installed using the default installation type of server core installation (no-GUI). This server will be the first domain controller in a brand new Active Directory forest. You’ve completed the following configuration prior to attempting to turn this server into a domain controller: Install all the available Windows Updates Set the time zone Set the computer name Set a static IP address Log into the server and launch PowerShell by typing powershell.

What’s the Recommended Editor for PowerShell Scripts?

You’ve probably heard, as I have, that Visual Studio Code (VSCode) is the latest whiz-bang editor that you should be using for PowerShell (and I am for development of PowerShell code on my primary workstation). One word of caution though is to make sure to put things into perspective and not be so quick to shun people away from using the PowerShell Integrated Scripting Environment (ISE), depending on how they’re using it.

Managing the Hyper-V Default Switch in Windows 10 version 1709 and higher with PowerShell

Windows 10 version 1709 introduced a default Hyper-V virtual switch which is installed when the Hyper-V role is added. As you can see in the following example, by default on Windows 10, the default virtual switch does not exist because the Hyper-V role hasn’t been added. Get-NetAdapter Now that the Hyper-V role has been added, you can see that a new network adapter named “vEthernet (Default Switch)” exists. Get-NetAdapter | Format-Table -AutoSize While you wouldn’t think this would be a problem, I’ve seen some latency problems on the host operating system once this default switch is added.

PowerShell Script Module Design: Building Tools to Automate the Process

As I previously mentioned a little over a month ago in my blog article PowerShell Script Module Design Philosophy, I’m transitioning my module build process to a non-monolithic design in development and a monolithic design for production to take advantage of the best of both worlds. Be sure to read the previously referenced blog article for more details on the subject. My goal is to write a reusable tool to retrieve the necessary information from a non-monolithic script module that’s necessary to create a monolithic version of the same module.

Learn about the PowerShell Abstract Syntax Tree (AST) – Part 3

This blog article is the third in a series of learning about the PowerShell Abstract Syntax Tree (AST). Be sure to read the other two if you haven’t already. Learning about the PowerShell Abstract Syntax Tree (AST) Learn about the PowerShell Abstract Syntax Tree (AST) – Part 2 Learn about the PowerShell Abstract Syntax Tree (AST) – Part 3 In this blog article, I’ll be specifically focusing on finding the AST recursively.

Learn about the PowerShell Abstract Syntax Tree (AST) – Part 2

In my previous blog article a few weeks ago on Learning about the PowerShell Abstract Syntax Tree (AST), I mentioned there was an easier way to retrieve the AST so that you didn’t have to cast everything to a script block. There are two .NET static methods, ParseFile and ParseInput, that are part of the Parser Class in the System.Management.Automation.Language namespace which can be used to retrieve the AST. First, I’ll store the content of one of my functions in a variable.

Use PowerShell to Monitor IIS Websites and Application Pools

I recently received a request to write a script for monitoring IIS websites and their application pools on a specific Windows 2012 R2 server and start them if they were stopped. This is something I created fairly quickly and thought I would share. I always try to centralize any scripts I write and have them run on a job server instead of the actual server they’re querying. That way I don’t have multiple versions of the same script floating around on different servers.

Deploy an Enterprise Grade Network in the Home for Less than $500

Last month I decided to embark on a networking project to rid my home of poor connectivity. I tweeted out asking about the benefits of Cat 6 cable since I already owned enough Cat 5e to complete the entire project. The primary benefit of Cat 6 cable for a home environment seems to be future proofing since Cat 5e is perfectly capable of Gigabit. Ultimately, the free Cat 5e cable won out because it left more money in the budget for new networking equipment.

Use PowerShell to Install the Remote Server Administration Tools (RSAT) on Windows 10 version 1809

My computer recently updated to Windows 10 version 1809 and as with all previous major updates of Windows 10, this wipes out the Remote Server Administration Tools (RSAT). However, unlike previous versions, Microsoft has now made RSAT available via Features on Demand and while you’re supposed to be able to install them from the GUI, they never showed up as being an option for me. That’s not really a problem though since they can now be installed via PowerShell.

Learning about the PowerShell Abstract Syntax Tree (AST)

This week, I’ll continue where I left off in my previous blog article PowerShell Script Module Design Philosophy. Moving forward, the development versions of my PowerShell script modules will use a non-monolithic design where each function is dot-sourced from the PSM1 file. When I move them to production, I’ll convert them to using a monolithic design where all functions reside in the PSM1 file. In development, each PS1 file uses a Requires statement which specifies the requirements from a PowerShell version and required modules standpoint.

PowerShell Script Module Design Philosophy

Years ago, when I first learned how to create PowerShell script modules, I built them with all the functions in one huge monolithic PSM1 file. I like the monolithic script module design from a performance and security standpoint along with the ease of signing fewer files if you’re taking advantage of code signing to digitally sign your scripts and modules (there are fewer files to sign). What I don’t like is that collaborating with others using one huge file is a merge conflict waiting for a place to happen and if someone only wants one of my functions instead of the entire module, they’re out of luck unless they want to copy and paste it.

PowerShell Script Module Design: Don’t Use Asterisks (*) in your Module Manifest

Using asterisks (*) in your module manifest is a bad idea no matter how you look at it. First, your module will be slower because it will have to figure out what to export. More importantly, if you use a “#Requires -Modules” statement in your functions and they’re in separate PS1 files, all of the specified module’s commands will show as being part of your module. I’ll pick up where I left off in one of my previous blog articles PowerShell Script Module Design: Plaster Template for Creating Modules.

Indentation and Formatting Style for PowerShell Code

My preferred indentation style when writing PowerShell code is Stroustrup style because I don’t like my code to cuddle (there’s no cuddled else in Stroustrup style). I occasionally hear from others that they don’t like this style because it doesn’t work from the PowerShell console. if ($plasterParams.Git) { $ModulePath = "$($plasterParams.DestinationPath)\$($plasterParams.GitRepoName)\$($plasterParams.Name)" } else { $ModulePath = "$($plasterParams.DestinationPath)\$($plasterParams.Name)" } While it doesn’t work by default, there’s a trick to making that style work from the PowerShell console.

PowerShell Script Module Design: Plaster Template for Creating Modules

I recently began updating my PowerShell script module build process. Updating my Plaster template was one of the first things I needed to do. If you haven’t already read my blog article about Using Plaster to create a PowerShell Script Module template, I’d recommend beginning there as this blog article assumes you already have a basic understanding of how to use Plaster. All of the information from my previous Plaster template is still there with the exception of the required PowerShell version as I plan to obtain that information and update it a different way.

The PowerShell Conference Book – It’s a Wrap!

First, I’d recommend reading my blog article Announcing the PowerShell Conference Book if you haven’t. In early May of this year (2018), I came up with the idea of what would become The PowerShell Conference Book. On the evening of May 6th, I sent an email to Don Jones and Jeff Hicks asking what they thought and if they’d be interested in writing a chapter in the book. The next morning, I’d received positive responses from both of them, confirming that they would be interested in participating.

PowerShell Script Module Design: Public/Private versus Functions/Internal folders for Functions

There’s been a lot of debate about script module design as of lately and instead of tweeting something out asking for responses, I thought I would post it here via a blog article. Back when I first started creating PowerShell script modules, I placed all of my functions in the PSM1 file and later started placing each function in a separate PS1 file that was dot-sourced from the PSM1 file.

Determine the Day of the Week in 11 Days from Now with PowerShell

A couple of days ago, one of my kids asked me “What day of the week will it be in 11 days from now?”. My response was “I’m not sure, but I can tell you how to figure out the answer for yourself”. Open up PowerShell, wrap Get-Date in parentheses, place a dot or period afterwards, followed by AddDays, then 11 in another set of parentheses, and finally another dot or period followed by DayOfWeek.

PowerShell Saturday Chattanooga Post-Mortem

PowerShell Saturday Chattanooga was this past weekend. I attended the all-day preconference presented by Jeff Hicks on Friday which saw a great turn out of about 50 people or so. I presented two 45-minute sessions as part of the Saturday event. One on Writing award winning PowerShell functions and script modules and another on Recreate MOF based DSC resources as Class based DSC resources. The code and slide decks from both of my presentations can be found in my presentations repo on GitHub.

Named One of the Top 21 SysAdmin Influencers, Bloggers and Geeks to Follow

I was recently named as one of the top 21 SysAdmin influencers, bloggers, and geeks to follow on this years' SysAdmin Day by IT Chronicles. I’m humbled and honored to be part of their list. There are also several other Microsoft Cloud and Datacenter Management MVP’s for Windows PowerShell on the list. If your interested in PowerShell (and you probably are if you’re reading this blog site), I’d recommend taking a look at the original article on the IT Chronicles website.

Determine if a Mailbox is On-Premises or in Office 365 with PowerShell

One of the companies that I support is currently in the process of migrating from an on-premises Exchange Server environment to Office 365. They’re currently running in hybrid mode. While it seems like wanting to know what mailboxes still exist onsite versus which ones are in the cloud would be an all too common task, there doesn’t seem to be an easy way to get that information with PowerShell. You would think that you’d be able to run a PowerShell command and it would return the results.

Displaying Toast Notifications for a Different User when PowerShell Module Updates are Available

A couple of months ago, Josh King presented a session on Using BurntToast to Display Timely Notifications for our June 2018 Mississippi PowerShell User Group virtual meeting. I was previously planning to write something to display balloon notifications in Windows and I learned that they’re now called toast notifications. I also learned that Josh had created a module named BurntToast which performs most of the heavy lifting so I could simply take advantage of it instead of writing my own code.

Use PowerShell to Determine What Your System is Talking to

Recently, while troubleshooting a problem with a newly installed application, I wanted to see what it was communicating with. My only requirement was that I wanted to use PowerShell if at all possible. I couldn’t remember if there was a PowerShell command for accomplishing this task or not, but I remembered seeing something about it in Patrick Gruenauer’s chapter (PowerShell as an Enterprise Network Tool) in The PowerShell Conference Book.

The PowerShell Conference Book is the Featured Book and the Number 1 Best Seller on Leanpub

By now, I’m sure you’ve heard about The PowerShell Conference Book. If not, see my previous blog article. The PowerShell Conference Book is currently the featured book on Leanpub. It’s also the number one best seller on Leanpub. And the top book on Leanpub. The book was published last Friday, July 6th with nine of the thirty-three chapters and we’ve added an additional six chapters since then. I would like to thank everyone who has purchased the book so far.

Announcing the PowerShell Conference Book

A couple of months ago, I saw a tweet from Don Jones about how much it costs to sponsor one person for the OnRamp Scholarship Program. I replied wanting to know if the DevOps Collective had considered becoming part of the Leanpub for Causes program so that portions of an author’s royalties could be donated to the program. My initial thought was that I could donate a portion of the royalties from my PowerShell 101 book to the program.

Renewed as a Microsoft Cloud & Datacenter Management MVP

I’m honored and humbled to be renewed as a Microsoft Most Valuable Professional (MVP) for a fifth consecutive year. I received notification this past weekend confirming that I’ve been renewed for another year. The first two Microsoft MVP awards that I received were for PowerShell and due to changes to Microsoft’s MVP award program, the latest three have been for Cloud and Datacenter Management, although my focus is still PowerShell.

Update a Severely Out of Date GitHub Repository Fork

Recently, I received notification from Planet PowerShell that they will be removing blogs that do not support HTTPS as of August 1st. I had forked their repo on GitHub over a year ago, added my blog, and submitted a pull request. I hadn’t touched my fork of their repo since then. It was severely out of date and in an unknown state. Taking a look at it on my system showed my local copy only had one remote which was my fork on GitHub.

Use PowerShell to Install Windows Features and Reboot

Recently, I installed the Windows Subsystem for Linux (WSL) feature on my Windows 10 computer. Microsoft has an installation guide that walks you through the entire process, but I thought I’d share a few PowerShell tricks when it comes to installing Windows features. The system used throughout this blog article runs Windows 10 version 1803 which ships with Windows PowerShell version 5.1. Your mileage may vary if you’re using a different version of Windows and/or PowerShell.

TechSnips is Looking for Content and Recruiting Contributors

This blog article is the first guest post ever on this site. When I’m approached by someone who wants to write a guest blog article, I suggest that they should start their own blog. If they’re simply not interested in that, I put them in contact with PowerShell.org because it seems like a more appropriate place to publish community blog articles. The majority of the posts on this site are simply the steps of how I’ve done something in a real-world production environment.

Convert Scientific Notation to Decimal with PowerShell

Have you ever run into a problem where the results from a PowerShell command are returned in scientific notation? I’ve recently been working with performance counters in PowerShell and I’ve run into several scenarios where this occurs such as the one shown in the following example. (Get-Counter -Counter '\PhysicalDisk(*c:)\Avg. Disk sec/Read' -OutVariable Results).CounterSamples In addition to returning the results in the previous example, they were also stored in a variable so the same value could be used throughout this blog article.

Configuring “Send As” Permission in Office 365 using PowerShell

You’re the administrator of an on-premises Exchange Server 2010 environment that’s in Hybrid mode. After migrating a few users to Office 365, you start receiving complaints that they’re no longer able to send emails as their departments group. First, follow the instructions in one of my previous blog articles to Connect to Office 365 using PowerShell. The following command grants John Doe the ability to send as the Facility Services group in Office 365.

Assign a License to an Office 365 User with PowerShell

There are several scenarios where you might need to assign an Office 365 license to a user. The specific scenario in this blog article is that you’re migrating an Exchange Server 2010 on-premises environment to Office 365. The Exchange Server is already in hybrid mode. Users have been automatically created in Office 365 by synchronizing them from your on-premises Active Directory environment using Azure AD Connect. Users who haven’t already had their mailbox moved to Office 365 will first need an Office 365 license assigned to them, and before a license can be assigned to them, a usage location must be set on their individual account.

Connect to Office 365 with PowerShell

I’ve recently been working on a project to migrate an Exchange Server 2010 environment to Office 365. As with Exchange, there are several things that simply can’t be done from the GUI in Office 365. This means that if you’re the Office 365 administrator for your company, you’ll need a certain level of proficiency with PowerShell to effectively do your job . While not requirements, this blog article is written using Windows 10 Enterprise Edition version 1803 and PowerShell Core version 6.

Video: Recreate MOF based DSC resources as Class based DSC resources

Last month I presented a session on how to Recreate MOF based DSC resources as Class based DSC resources at the PowerShell + DevOps Global Summit in Seattle, Washington. The session seemed to be well received by the audience based on the feedback that I received from the attendees. The video from this presentation is now available. The code and slides used during the demonstration can be found in my presentations repository on GitHub.

Video: Writing Award Winning PowerShell Functions and Script Modules

Last month I presented a session on Writing Award Winning PowerShell Functions and Script Modules at the PowerShell + DevOps Global Summit in Seattle, Washington. The session seemed to be well received by the audience based on the feedback that I received from the attendees. The session was also completely full. I’m glad it was recorded so anyone who was unable to attend can watch it. The video from this presentation is now available.

PowerShell Core 6: ValidatePattern Custom Error Messages

Last week, I received a comment on my previous blog article from fellow Microsoft MVP Joel Bennett which referenced using an ErrorMessage parameter similar to how ValidatePattern works in PowerShell Core version 6. I knew I’d seen some discussion about this on GitHub, but I wasn’t aware that it had made it into the production release. Joel’s message is shown in the following image. I had to figure out how to use custom error messages with ValidatePattern.

Simplifying Parameter Validation in PowerShell with Private Functions

In my previous blog article, I described how to move code from ValidateScript to a private function for parameter validation in PowerShell. This all came about from a question I received in one of my sessions at the PowerShell + DevOps Global Summit a couple of weeks ago. I enjoy following up with attendees of my presentations when they have questions so I sent a message and a link to my previous blog article to the person who asked if that was possible.

Moving Parameter Validation in PowerShell to Private Functions

While presenting one of my presentations at the PowerShell + DevOps Global Summit last week, I demonstrated why you wouldn’t want to use ValidatePattern for parameter validation because of the useless error message that it returns when the input doesn’t match the regular expression that’s being used for validation. function Test-ValidatePattern { [CmdletBinding()] param ( [ValidatePattern('^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\"";|/]+$')] [string]$FileName ) Write-Output $FileName } I then demonstrated how ValidateScript could be used to build a better ValidatePattern.

Remotely Uninstall ESET Antivirus with PowerShell

Recently, one of the companies that I provide support for switched from using ESET to a new antivirus vendor. The problem is that all of their servers had both ESET File Security and the ESET Remote Administrator Agent installed which needed to be uninstalled before installing the new antivirus agent. I determined that the following commands could be used to uninstall the applications. #Uninstall Eset Remote Administrator Agent sc.exe delete eraagentsvc msiexec.

Adding Multiple Parameter Sets to a PowerShell Function

Sometimes you need to add more than one parameter set to a function you’re creating. If that’s not something you’re familiar with, it can be a little confusing at first. In the following example, I want to either specify the Name or Module parameter, but not both at the same time. I also want the Path parameter to be available when using either of the parameter sets. function Test-MrMultiParamSet { [CmdletBinding(DefaultParameterSetName='Name')] param ( [Parameter(Mandatory, ParameterSetName='Name')] [string[]]$Name, [Parameter(Mandatory, ParameterSetName='Module')] [string[]]$Module, [string]$Path ) $PSCmdlet.

Using Plaster to create a PowerShell Script Module template

I have a function in my MrToolkit module named New-MrScriptModule that creates the scaffolding for a new PowerShell script module. It creates a PSM1 file and a module manifest (PSD1 file) along with the folder structure for a script module. To reduce the learning curve of Plaster as much as possible, I’m simply going to replace that existing functionality with Plaster in this blog article. Then moving forward, I’ll add additional functionality.

Temporarily Disable the Azure AD Connect Accidental Deletion Protection Feature with PowerShell

You’ve implemented Azure AD Connect to synchronize accounts in your on-premises Active Directory environment to Azure AD. If you took the defaults while running the setup wizard for Azure AD Connect, then everything in your Active Directory environment is synchronized. If you decided to filter the synchronization later to only specific OU’s (Organizational Units) in your Active Directory environment, you could run into a scenario where the number of deletions exceeds the default threshold of 500 objects.

The PowerShell Iron Scripter: My solution to prequel puzzle 3

I’ve been working through the Iron Scripter 2018 prequel puzzles which can be found on PowerShell.org’s website. In puzzle 3, you’re asked to create a “reusable PowerShell artifact”. To me, that almost always means a PowerShell function. One requirement is to pull information from the PowerShell.org RSS feed. Invoke-RestMethod which was introduced in PowerShell version 3.0 is the easiest way to accomplish that task. You’re also asked to display the returned information in a way that allows the user to select an item from the feed.

Help in PowerShell Core is independent of help in Windows PowerShell

You’ve decided to install PowerShell Core on your Windows system. First of all, keep in mind that PowerShell Core version 6.0 is not an upgrade or replacement to Windows PowerShell version 5.1. It installs side by side on Windows systems. Being aware of this makes what is shown in this blog article make more sense, otherwise it can be confusing. Based on the response to a tweet of mine from Don Jones, it appears that I’m not the only one who thought PowerShell Core should have been version 1.

The PowerShell Iron Scripter: My solution to prequel puzzle 2

As I mentioned in my previous blog article, each week leading up to the PowerShell + DevOps Global Summit 2018, PowerShell.org will be posting an iron scripter prequel puzzle on their website. As their website states, think of the iron scripter as the successor to the scripting games. If you haven’t done so already, I recommend reading my solution to the Iron Scripter prequel puzzle 1 because some things are glossed over in this blog article that were covered in detail in that previous one.

The PowerShell Iron Scripter: My solution to prequel puzzle 1

Each week leading up to the PowerShell + DevOps Global Summit 2018, PowerShell.org will be posting an iron scripter prequel puzzle on their website. As their website states, think of the iron scripter as the successor to the scripting games. I’ve taken a look at the different factions and it was a difficult choice for me to choose between the Daybreak and Flawless faction. While I try to write code that’s flawless, perfection is in the eye of the beholder and it’s also a never-ending moving target.

Use PowerShell to create a bootable USB drive from a Windows 10 or Windows Server 2016 ISO

It seems as if every time I need to reload a physical system, I’m searching the Internet to find a way to create a bootable USB drive from a Windows 10 or Windows Server 2016 ISO. I always seem to find tutorials that are using a process that’s almost 20 years old. They have me using the diskpart command line utility. Diskpart which initially shipped with Windows 2000, reminds me way too much of its predecessor, the fdisk command line utility.

PowerShell Compare-Object doesn’t handle null values

I thought I’d run into a bug with the Compare-Object cmdlet in PowerShell version 5.1 earlier today. $DriveLetters = (Get-Volume).DriveLetter $DriveLetters Compare-Object -ReferenceObject $DriveLetters -DifferenceObject $DriveLetters _Compare-Object : Cannot bind argument to parameter ‘ReferenceObject’ because it is null. At line:1 char:33 Compare-Object -ReferenceObject $DriveLetters -DifferenceObject $Driv … CategoryInfo : InvalidData: (:) [Compare-Object], ParameterBindingValidationException FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.CompareObjectCommand_ Running the same commands on a VM with PowerShell version 5.0 completed without issue so it initially appeared to be a problem with the `Compare-Object` cmdlet in PowerShell version 5.

PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell is the featured book on Leanpub

Learning PowerShell seems to be a hot topic for the new year. My PowerShell 101 book was the number one bestseller on Leanpub earlier this week and now it’s the featured book on their website. Going to the homepage on their website, shows the book is indeed the currently featured one. I would also like to thank Tommy Maynard for the technical editing he performed on the book. If you’re not following him on Twitter or reading the articles on his blog site, you should be.

Using PowerShell to Check Remote Windows Systems for CVE-2017-5754 (Meltdown) and CVE-2017-5715 (Spectre)

The Microsoft Security Response Center has released a PowerShell module named SpeculationControl that can be used to check for the CVE-2017-5754 (Meltdown) and CVE-2017-5715 (Spectre) vulnerabilities. The SpeculationControl module can be installed from the PowerShell Gallery with Install-Module which is part of the PowerShellGet module that ships natively with PowerShell version 5.0, but can be installed on PowerShell version 3.0 and higher. Install-Module -Name SpeculationControl -Force Running the one function Get-SpeculationControlSettings contained in the SpeculationControl module is simple enough, although it does require the script execution policy to be set to remote signed or less restrictive.

PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell is the number one bestseller on Leanpub

I would like to thank everyone who helped make my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell, the number one bestseller on Leanpub.com. As shown in the previous image, PowerShell 101 is the number one top book on their homepage. It’s also the number one bestseller on their site in the last week: And the book with the most copies sold in the last week: Today is the last day to purchase the book using the special year’s end promotion, but as always with Leanpub.

My new PowerShell book is on sale for 99-cents until the end of the year!

On Christmas day, I announced that my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell had been completed. I gave away 10 copies of it along with placing it on sale for 99-cents (reduced from the suggested price of $15.99) until the end of the year. Time is running out, but there’s still time to grab a copy at this price. Use this URL to access the 99-cent sale.

Merry Christmas! I’m giving away 10 free copies of my PowerShell 101 book

Earlier this year, I announced that I would be writing a new book PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell that would be completed before the end of the year and published on Leanpub.com. As I wrote the chapters, I incremented the percentage complete on the book’s webpage. A few days ago, I made a few final corrections and marked the book as being 100% complete. One thing that I’m a big believer in is do what you say you’re going to do.

Generate a Secret Santa List with PowerShell

It’s supposed to be the most wonderful time of the year and while you might buy multiple Christmas gifts for everyone in your immediate family, often times buying for everyone in your extended family or for all of your co-workers is cost prohibitive. I originally started out with a simple idea to create a PowerShell script to take a list of names and generate a second random list of names based off of the first one while making sure the corresponding name on the second list doesn’t match the first one.

Retrieve Basic Operating System Information with PowerShell

PowerShell version 5.1 added a new cmdlet named Get-ComputerInfo which retrieves lots of information from the local computer. It can be wrapped inside of the PowerShell remoting Invoke-Command cmdlet to retrieve that same information from remote computers. My biggest complaint with Get-ComputerInfo is that it takes forever to return the information and then when it does finally complete, it’s missing values for most of its properties. Also, if you’re going to wrap it inside of Invoke-Command, then all of your remote machines would need PowerShell 5.

Determine the Start Time of a Windows Service with PowerShell

Recently, I was asked to setup a scheduled task or job to restart specific services on certain servers each night and while that’s simple, how do you know for sure the services were indeed restarted? One way is to determine how long a service has been running or when they were started. The dilemma is the necessary information isn’t available using the Get-Service cmdlet or with CIM or WMI using the Get-CimInstance or Get-WmiObject cmdlets with the Win32_Service class.

An Uncommon Cause for IIS 503 Service Unavailable Errors

Recently, while migrating IIS websites to a new server, I encountered “Service Unavailable HTTP Error 503. The service is unavailable.” errors, but only for HTTPS, while HTTP worked fine. Depending on the scenario, the problem could have just as easily impacted HTTP. The server was listening on port 443: Get-NetTCPConnection -LocalPort 443 -State Listen If you ever encounter a problem like this, stop the web publishing service: Stop-Service -Name w3svc -PassThru Then check to see if the server is still listening on port 443:

Access Local Variables in a Remote Session with PowerShell

Occasionally I’ll come across a system with PowerShell version 2.0 on it that I need to run a remote command against which needs access to local variables. I can never remember how to accomplish that task so I thought I would write a blog about it as a reminder for myself and others who may find themselves in the same scenario. I’ll demonstrate each of the available options and whether or not they work on PowerShell version 5.

Safety to prevent entire script from running in the PowerShell ISE

I recently watched fellow Microsoft MVP Thomas Rayner present a session on regular expressions for the MVP Days virtual conference. Sometimes it’s the little things that are the biggest takeaways for me when I’m watching others present. One thing that wasn’t related to regular expressions that I noticed was Thomas’s way of preventing his entire script from running if F5 was accidentally pressed instead of F8 in the PowerShell ISE (Integrated Scripting Environment).

Registration for the PowerShell & DevOps Global Summit 2018

Registration for the PowerShell & DevOps Global Summit 2018 opens on Wednesday, November 1st which is less than one week away. I’ve attended every one of these conferences that have been held in North America since its inception 5 years ago. I speak from experience when I say now is the time to ask for approval to attend this conference because it has sold out each year and it’s not a matter of if it will sell out, but when will it sell out?

Configure Internet Connection Sharing with PowerShell

My test environment runs as Hyper-V VM’s on my IBM Thinkpad P50. I use ICS (Internet Connection Sharing) to shield my Hyper-V test environment virtual network from my production network connection. ICS allows me to temporarily give my test VM’s Internet access when needed without putting them directly on the production network. You might ask why? Because my test environment VM’s run things like DHCP servers that would cause havoc on the production network.

Windows Server 2016 Automation with PowerShell Cookbook – Second Edition

One of the projects that I’ve been a part of this year that’s now complete is Windows Server 2016 Automation with PowerShell Cookbook - Second Edition written by Thomas Lee and published by Packt Publishing. I personally read each and every page of the book while it was being written along with testing every single line of code in each of the recipes in the book. According to the book’s webpage on the Packt Publishing website, it has more than a hundred recipes and we’re not talking about one-liners.

Presenting The No-Nonsense Beginner’s Guide to PowerShell for the Austin PowerShell User Group on October 5th

If you’re interested in some free PowerShell training where you’ll learn the basics of PowerShell from a best practices standpoint, I’ll be presenting a session on PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell for the Austin PowerShell User Group this Thursday, October 5th. The presentation begins at 6pm central time and is a beginner level session. Here’s a little information about what you can expect from the presentation: Interested in PowerShell but not sure how to get started?

Regions now available in VSCode Insiders Build version 1.17.0

Today, David Wilson from the PowerShell team at Microsoft, announced that Regions are now available in VSCode (Visual Studio Code) as of insiders build version 1.17.0. I was hoping the region and endregion keywords would be case-insensitive unlike in the PowerShell ISE where they’re case-sensitive. It looks like that’s indeed what they intended since the region keyword is case-insensitive in VSCode, but unfortunately the endregion keyword is case-sensitive as shown in the following example.

PowerShell Toolmaking session this Saturday, September 30th at Gulf Coast Code Camp 2017 in Mobile, Alabama

Got no training budget? This Saturday, September 30th, is your opportunity to show some initiative by leveling up your skills on your own time and at your own expense (it’s free) at Gulf Coast Code Camp 2017. The venue is at the University of South Alabama and features 16 speakers who are experts in the technology space. While I can’t speak for everyone else who is presenting, my session begins at 9:40am central time where you’ll learn the industry’s best practices for PowerShell Toolmaking with Advanced Functions and Script Modules from a previous winner of the advanced category in the scripting games who is also a multiyear recipient of both Microsoft’s and SAPIEN Technologies MVP award.

Not Specifying a Verb in PowerShell is an Expensive Shortcut

When working with PowerShell, there are lots of shortcuts that can be taken and while some of them may seem like a good idea at first, they usually end up costing you more trouble than they’re worth in the long run. I recently saw a Tweet that a fellow PowerShell enthusiast Tore Groneng‏ responded to which referenced running commands in PowerShell without specifying a verb. Such as “Service” for Get-Service.

Detect the presence of and remove CCleaner with PowerShell

Based on the news today, I thought I would share a couple of PowerShell code snippets to detect the presence of and silently uninstall CCleaner. You can detect the presence of CCleaner along with the version of it you have installed via the registry. Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -eq CCleaner You can use a similar command to run its uninstaller silently if it’s detected. if (Get-ItemProperty -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object DisplayName -eq CCleaner -OutVariable Results) { & "$($Results.

PowerShell Version 2 Compatible Function to Determine Windows Firewall State

I recently had a need to perform some security auditing on an environment that still has some servers running PowerShell version 2 (PowerShell version 2 is deprecated). One of the things I needed to determine was whether or not the Windows firewall was enabled on each of the servers in the environment. Luckily, all of the servers at least had PowerShell remoting enabled. #Requires -Version 2.0 function Get-MrNetFirewallState { <# .

Remotely cleanup log and temp files from your Windows based servers with PowerShell

Setting up a scheduled task or job on individual servers to cleanup log and temp files just doesn’t scale very well because you have scheduled tasks or jobs setup on lots of individual servers that need to be maintained. Today it’s this server and tomorrow it’s two or three more. It’s much easier to setup one scheduled task or job on a server that’s designed for management to remotely cleanup the desired files on all of your servers.

Using Out-GridView to simplify selecting the region when managing Microsoft Azure with PowerShell

You’ve signed up for a Microsoft Azure accountand you’ve installed the Azure Resource Manager PowerShell cmdlets on your computer. Install-Module -Name AzureRM -Force You login to Azure from PowerShell. You’ll normally see most people use Login-AzureRmAccount, but that command is an alias (Login isn’t an approved verb). Get-Alias -Definition Add-AzureRmAccount Login to Azure and provide the account login information when prompted: Add-AzureRmAccount Several of the cmdlets in the Azure Resource Manager PowerShell module require a location (a region) to be specified when creating things.

How to install Visual Studio Code and configure it as a replacement for the PowerShell ISE

If you follow me on Twitter,then I’m sure you’re aware that I’ve been using nothing but VS Code (Visual Studio Code) as a replacement for the PowerShell ISE (Integrated Scripting Environment) for the past couple of weeks and while I had tried it in the past, I didn’t previously think it was ready for prime time. That’s now changed with all of the updates and work that has gone into it.

VS Code Rendering Problem in the PowerShell Integrated Terminal

I recently discovered a rendering problem in VS Code where pressing escape doesn’t delete a multi-line command in the PowerShell integrated terminal. I created a videoto report the problem and I thought I would share it here since the quality was less than optimal when sharing it on Twitter. Here’s a link to my original tweetto David Wilsonand here’s a link to the GitHub issuethat Max Trinidadhas created. µ

PowerShell One-Liner to Audit Print Jobs on a Windows based Print Server

You’ve been tasked with auditing print jobs on your company’s Windows based print server to determine who is wasting so much paper, toner, and causing excessive wear and tear on printers. No budget exists for this task and you need to have something to show by the end of the day. You would probably start off by searching the Internet, but most of the results you’ll find to accomplish this task are over-complicated or simply don’t work.

PowerShell PackageManagement and PowerShellGet Module Changes in Windows 10 Version 1511, 1607, and 1703

Recently, I reloaded my computer and noticed a problem when I tried to install the latest version of the Pester PowerShell module using PowerShellGet. I loaded Windows 10 version 1703 (the creators update) which has PowerShell version 5.1 installed by default: Get-CimInstance -ClassName Win32_OperatingSystem -Property Caption, BuildNumber, OSArchitecture | Select-Object -Property @{label='Operating System';expression={$_.Caption}}, @{label='Version';expression={Get-ItemPropertyValue -Path 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -Name ReleaseId}}, BuildNumber, OSArchitecture $PSVersionTable.PSVersion Pester version 3.4.0 ships with both Windows 10 version 1607 and 1703.

Presenting PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell this weekend at SQL Saturday Baton Rouge

Late last night I received an email about a session being cancelled at SQL Saturday #628 in Baton Rouge which is scheduled for tomorrow, Saturday, July 29th. I’ll be presenting my PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell session in that time slot which is the first session of the day in the PowerShell track, beginning at 9:15am. ](/images/2013/07/sqlsatbr.jpg)I’ve presented this session a couple of times this year at other events and I’ve tweaked it each time based on the feedback I’ve received.

Operational Validation Testing of SQL Server with PowerShell and Pester this weekend at SQL Saturday Baton Rouge

If you’re interested in a free day of PowerShell training, there are numerous sessions on different topics in the dedicated PowerShell track at SQL Saturday #628in Baton Rouge, Louisiana this Saturday, July 29th. I’ll be presenting a session on how to “Automate Operational Readiness and Validation Testing of SQL Server with PowerShell and Pester”. ](/images/2017/07/sqlsatbr2017.jpg)Here’s a little information about what you can expect from my session: Automate Operational Readiness and Validation Testing of SQL Server with PowerShell and Pester How do you know whether or not all of the SQL Servers in your environment are configured based on your organizations standards?

Remove all user defined variables without restarting the PowerShell Console or ISE

Recently, fellow Microsoft MVP Mickey Goussetasked me how to remove existing user defined variables from the PowerShell ISE (Integrated Scripting Environment) before running a script a second time without having to restart the ISE. While you could keep track of the variables you’ve used within your script to remove them once the script completes with the Remove-Variable cmdlet or by deleting them from the variable PSDrive, that can be a less than desirable solution for long and complicated scripts that define lots of variables.

Copy databases from 5 different SQL Servers in 100 seconds with the DBATools PowerShell Module

As referenced in my blog article from yesterday, I’ll be presenting a PowerShell 101 sessionat SQL Saturday Atlantatomorrow morning (July 15, 2017). While I plan to cover the basics of PowerShell, I also plan to show you what you can do with PowerShell without having to write very much code at all. I’ll be killing it in my session with live demos including this one that I’ve made a video of as a sneak preview.

Presenting PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell this weekend at SQL Saturday Atlanta

If you’re interested in some free PowerShell training where you’ll learn the basics of PowerShell from a best practices standpoint, I’ll be presenting a session on “PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell” at SQL Saturday #652in Atlanta, Georgia this Saturday, July 15th. ](/images/2017/07/sql-saturday-652.png)My presentation begins at 8am eastern time and is a beginner level session. There’s also a Powering Azure from PowerShellsession that Microsoft MVP Robert Cainis presenting at 2:15pm.


Renewed as a Microsoft Cloud & Datacenter Management MVP

I’m honored and humbled to have been awarded the Microsoft MVP awardfor a fourth consecutive year. I received email notification yesterday confirming that I’ve been renewed for another year. The first two Microsoft MVP awards that I received were for PowerShell and due to changes to Microsoft’s MVP award program, the latest two have been for Cloud and Datacenter Management, although my focus is still PowerShell. ](/images/2017/07/cdm-mvp2017.jpg)In addition to being a multiyear recipient of the Microsoft MVP award, I’m also a multiyear recipient of the SAPIEN Technologies MVPaward.

Automatically Customizing the PowerShell ISE on Startup

This past weekend while at SQL Saturday Chattanooga, I was asked if it was possible to have the PowerShell ISE (Integrated Scripting Environment) automatically open with a right/left split pane: Instead of the top/bottom default split pane: One thing to note is that by default the PowerShell ISE will reopen in whatever configuration you close it in, which could be either of the ones previously shown or the full screen editor.

Presenting PowerShell Non-Monolithic Script Module Design this weekend at SQL Saturday Chattanooga

If you’re interested in some free PowerShell training, I’ll be presenting a session on “PowerShell Non-Monolithic Script Module Design” at SQL Saturday #624in Chattanooga, Tennessee this Saturday, June 24th. ](/images/2017/06/sqlsat624.png)My presentation begins at 1:15pm eastern time and is an intermediate level session. There’s also a PowerShell preconon Friday being presented by Microsoft MVP Aaron Nelson(the precon is not free) and a PowerShell DSC (Desired State Configuration) sessionon Saturday being presented by Microsoft MVP Tim Warner.

Simple Obfuscation with PowerShell using Base64 Encoding

I recently received a question from someone wanting to know how I encoded a string of text on my blog site. Back in January of 2013, I competed in Jeff Hicks PowerShell Challengethat was held by TrainSignal. One of the questions had an encoded command which you were to decode. I figured out that the -EncodedCommand parameter of PowerShell.exe could not only be used to run commands that are encoded with Base64, that it could also be used to easily decode a string of text that was encoded with Base64.

What is this Module Scope in PowerShell that you Speak of?

Last week I posted a blog article about a PowerShell script module that I had written with a few proof of concept commands to manage a Nimble Storage Area Network using their REST API. That module used a command to connect and authenticate to the storage device which needed to share a token with other commands in the module otherwise authentication would have to be performed for each command. I initially placed the token in a global variable even though I mentioned in the blog article that I’m not a big fan of globally scoping variables unless absolutely necessary (which I thought it was at the time).

PowerShell and the Nimble Storage REST API

If you read my previous blog article on “PowerShell Function to Determine the Installed VSS Providers” then you’re already aware that I recently migrated one of my customers to a Nimble Storage Area Network. While Nimble does have a PowerShell module and it’s decent, I wanted to see how difficult it is to work with their REST API directly with PowerShell. Their REST API documentation also seems to be decent.

PowerShell Function to Determine the Installed VSS Providers

I’ve been migrating one of my customers from some older EqualLogic storage area networks to a Nimble SAN. It has all been good with the exception of some problems with VSS (Volume Shadow Copy Service). They use Altaro for backups and from what I’ve found, Nimble and Altaro don’t play well together when it comes to VSS. Nimble’s software was installed on the Hyper-V hosts and all three vendors (Nimble, EqualLogic, and Altaro) VSS providers seemed to play well together until volumes were actually moved to the Nimble SAN.

Use PowerShell to Determine if Specific Windows Updates are Installed on Remote Servers

It has been a crazy week to say the least. If you’re like me, you wanted to make sure that the specific Windows updates that patch the WannaCry ransomware vulnerability have been installed on all of your servers. I’ve seen a lot of functions and scripts this week to accomplish that task, but most of them seem too complicated in my opinion. While it’s personal preference, I also always think about whether I should use a PowerShell one-liner, script, or function.

Retrieve Information about your Favorite Podcast with PowerShell

This past weekend, I attended the 2017 Atlanta MVP Community Connection. While there, I met fellow Microsoft MVP Allen Underwoodwho is one of the co-host of the {CodingBlocks}.NETpodcast. I listened to their podcast on my trip back home from Atlanta and later discovered that their podcast has an RSS feed for episodes. A simple PowerShell one-liner can be used to retrieve information about each episode of their podcast: Invoke-RestMethod -Uri https://www.

PowerShell Function to Determine PSSessions to your Servers

This past week, I needed to determine if anyone had a PSSession connected to any of the servers that I support. This is fairly easy to accomplish with a PowerShell one-liner, but I can never remember the syntax so I decided to create a reusable function to accomplish the task. #Requires -Version 3.0 function Get-MrRemotePSSession { <# .SYNOPSISRetrieves a list of the Windows PowerShell sessions that are connected to the specified remote computer(s).

PowerShell One-Liner to Query multiple WMI Classes with a CIM Session

Today I thought I would share a one-liner that I recently wrote to query the Manufacturer, Model, and Serial Number information from numerous remote servers. Sounds simple enough, right? This one-liner starts out by using my New-MrCimSessionfunctionto create a CIM session to each of the specified servers. This function automatically determines if the remote server supports the WSMan protocol and falls back to DCom if it doesn’t: Get-CimSession | Select-Object -Property Name, ComputerName, Protocol Two different WMI classes are needed to retrieve the necessary information.

Determine the Default Password Policy for an Active Directory Domain with PowerShell

I’ve been working with PowerShell since the version 1.0 days and I’m still amazed that I find cmdlets that I didn’t know existed. Back in 2003, I had written some PowerShell code to query group policy for the lockout policy of an Active Directory domain. It used code similar to what’s shown in the following example which requires the GroupPolicy PowerShell module that installs as part of the RSAT (Remote Server Administration Tools).

Test Active Directory User Accounts for a Default Password with PowerShell

How do you control password resets in your environment? I’ve worked for numerous companies where their forgotten password reset process was all over the board. Hopefully you have a process in place that allows you to sleep at night. Even with the best policies and procedures in place, what happens when someone on your help desk staff resets a users password to some default password and forgets to set the account so the password has to be changed at next logon?

Video: PowerShell Non-Monolithic Script Module Design

This past Tuesday night, I presented a session on “PowerShell Non-Monolithic Script Module Design” for the Arizona PowerShell Users Group. The video from that presentation is now available. The presentation begins at 10 minutes and 30 seconds seconds into the video. The presentation materials to include the slide deck and code can be found in my presentations repository on GitHub. µ

PowerShell Function to Determine the Hyper-V Host for a VM

This week, I thought I would share a PowerShell function that I wrote to determine what Hyper-V host server a VM (virtual machine) resides on. In this scenario, you have no idea which Hyper-V host a VM resides on. #Requires -Version 3.0 function Get-MrVmHost { <# .SYNOPSISDetermines the HyperV host virtualization server for the specified virtual machines. .DESCRIPTIONGet-MrVmHost is an advanced function for determining the HyperV host virtualiztion server for one or more VMs (virtual machines).

Convert, Resize, and Optimize VHD and VHDX files with PowerShell

I recently received an email from someone who attended one of my presentations asking if I had a blog article on using PowerShell to compact and optimize VHD files. Since I didn’t have a blog article on that subject, I decided to create one. The process itself is fairly simple. The examples shown in this blog article are being run on a Windows 10 computer which has Hyper-V enabled on it.

Presenting 2 PowerShell sessions this weekend at SQL Saturday Birmingham

If you’re interested in some free PowerShell training, I’ll be presenting two PowerShell sessions at SQL Saturday #593in Birmingham, Alabama this Saturday, March 18th. ](/images/2017/03/sqlsat593.jpg)My first one hour presentation begins at 9:40am central time and is geared for beginners. The content covered in this session is based off of a book by the same titlethat I’m currently writing. PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell Interested in PowerShell but not sure how to get started?

PowerShell 101 Book Update: Chapter 4 Added

](/images/2017/01/powershell101-150x194-1.png)This morning, I published Chapter 4 of my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell. The book now contains chapters one through four and is forty percent complete. The book will contain a minimum of ten chapters when it’s completed later this year. Interested, but not ready to commit to purchasing it? Chapter 1 is available as a free download and I’ve created a videothat demonstrates many of the concepts covered in Chapter 1.

How to add your PowerShell blog to Planet PowerShell

Do you blog about PowerShell? If so, consider adding your blog site to Planet PowerShell which is an aggregator of content from PowerShell Community members. There are some guidelines for submission on their GitHub page so be sure to take a look at it before continuing. Instructions for adding your blog also exists on that page, but I’ve recently seen a number of tweets about it being too difficult or too much work.

PowerShell 101 Book Update: First 3 Chapters Now Available

Another update to my new book, PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShellis now available. The update which was published this morning added chapter 3 to the already available first two chapters. ](/images/2017/01/powershell101-150x194-1.png)If you’re interested in purchasing this book, consider buying it while it’s still a work in progress. The price of the book increases slightly with each chapter that’s released. Chapter 1 of the book is available as a free sample download.

PowerShell One-Liner to Disable Active Directory Accounts and Log the Results to a SQL Server Database

The new PowerShell cmdlets that are part of the SQLServer PowerShell module that’s distributed as part of SSMS (SQL Server Management Studio) 2016make it super easy to write the output of PowerShell commands to a SQL Server database. The ActiveDirectory PowerShell module that’s part of the RSAT (Remote Server Administration Tools)is also required by the code shown in this blog article. This PowerShell one-liner retrieves a list of Active Directory users who have not logged in within the past 120 days, are enabled, and exist in the Adventure Works OU (Organizational Unit).

Managing Altaro VM Backup with PowerShell

Recently, I decided to try to determine if there was a way to manage Altaro VM Backup with PowerShell. I figured there must be some database, files, or something that I could at least query with PowerShell. What I found is Altaro has a RESTful API and they have numerous PowerShell scripts for working with it. In Altaro version 7, there are 33 PowerShell scripts located in the “C:\Program Files\Altaro\Altaro Backup\Cmdlets” folder if you took the defaults during the installation, otherwise they’re wherever you installed Altaro.

Video: PowerShell 101 – The No-Nonsense Beginner’s Guide to PowerShell

Last week, I announced a new book for PowerShell beginners that I’m self-publishing. I decided to create a short video about the book and cover the topics from Chapter 1. The video can also be found on YouTube.com. The book (PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell) can be found on Leanpub.com. µ

Announcing a new book: PowerShell 101 – The No-Nonsense Beginner’s Guide to PowerShell

I’ve contributed, co-authored, performed technical reviews and edits on a number of PowerShell books. I also speak to a lot of beginners at user group meetings and technology events such as PowerShell Saturday’sand SQL Saturday’s. One thing I’ve found is there are still a lot of IT Pro’s out there who are reluctant to learn PowerShell and they’re often overwhelmed by information overload when they do try to learn it. What I mean by that is those of us who are fired up about going out there and educating people often open up our fire hose of knowledge which is way too much information to comprehend for someone just getting started with PowerShell.

A Great Backup Solution Just Got Better: Altaro VM Backup Version 7

Earlier this week, Altaroreleased a new version (version 7) of their award winning VM Backup software. Version 7 contains a number of new features that are compelling enough to warrant an upgrade if you have a previous version installed in your environment or a new installation if you’re currently using a different product for your disaster recovery solution. The top new features in version 7 include: Augmented Inline Deduplication Boot from Backup Support for Windows Server 2016 ](/images/2017/01/v7-badge.

Beware of the PowerShell Update-ModuleManifest Function

I recently presented a session for the Mississippi PowerShell User Group on PowerShell Non-Monolithic Script Module Design. While preparing for that session, I discovered that a problem I had previously experienced with Update-ModuleManifest when trying to update the FunctionsToExport section when FormatsToProcess is specified appeared to be resolved in PowerShell version 5.1 (I’m running build 14393). The details of this bug can be found here. I also noticed that Nicholas Getchell had written about this problem being resolved on his blog.

Using PowerShell to Audit Antivirus Updates on your Servers

How often do you check to make sure that things like antivirus has received the latest definition files on all of your servers? There’s probably some centralized GUI interface somewhere that you could log into and check. The antivirus product itself may even have some sort of notification system that sends alerts if the updates fail. Both of those options provide data in a format that can’t be worked with and what happens if something falls through the cracks?

Start a Blog to Build your Brand and Share your Knowledge

There are many reasons to blog. One of the main reasons that I blog is to document things for myself because if I don’t do something for six months, it’s highly unlikely that I’ll remember all of the details. Sure, maybe I have the code on GitHub, but many times there are caveats to performing some task or implementing something that wouldn’t necessarily be documented in the code itself. While I write my blog articles as documentation for myself, sharing them publicly helps me to make sure that I’m providing enough information so that others can benefit from reading the blog articles as well.

Renewed as a SAPIEN Technologies MVP for another year!

. They offer a 45 day evaluation for each of their products so you can try them out before you buy them. They also have forums where you can find assistance with not only their products but general PowerShell questions as well. If you’re looking for assistance with their products, that’s definitely the best place to post your questions."I received notification earlier this week that I’ve been renewed for another year (2017) as a SAPIEN Technologies MVP.

No PowerShell Cmdlet to Start or Stop Something? Don’t Forget to Check for Methods on the Get Cmdlets

Many PowerShell commands return output in the form of objects (some return nothing at all). An example of this is shown in the following example where properties and their corresponding values are returned. CommandType is a property and Cmdlet is the value for that particular property for each of the results: Get-Command -Noun Service -Module Microsoft.PowerShell.Management ](/images/2016/12/methods1a.pngmethods1a) Keep in mind that what is shown in the default output may not be the actual property names (compare the default output from Get-Process to the properties listed from Get-Process | Get-Member for an example of this).

Loop through a collection of items with the Pester TestCases parameter instead of using a foreach loop

One of the huge benefits of attending in-person technology events is getting to network with others. While at the MVP Summit last month I had a chance to demonstrate some of my PowerShell code and Pester tests to Jim Truher.I was developing the code and tests for a session to present for the PowerShell Virtual Chapter of SQL PASS(the code and a video of that presentation can be found here).

Locations for Comment-based Help in PowerShell Functions

One of the first things you’ll learn when beginning with PowerShell is how to use the help system. When working from the PowerShell console, I use the help function and omit the Name parameter since it’s positional and then specify the name of the cmdlet that I’m looking for help on as shown in the following example. help Get-HotFix ](/images/2016/12/help-locations1a.pnghelp-locations1a) This same type of standardized help can be added to your PowerShell functions and scripts which makes it easy for others to learn how to use them.

Learn to Query WMI (Windows Management Instrumentation) from PowerShell with SAPIEN WMI Explorer 2016

One of the reasons I like mentoring others and teaching them how to use PowerShell is that I spent the first third of my career pointing and clicking in the GUI. Before PowerShell was released, I had taken a three day MOC (Microsoft Official Curriculum) course on VBScript and two more days on WMI (Windows Management Instrumentation). I wrote a few VBScripts over the years but never really had a desire to learn it like I have PowerShell.

Write a GUI on Top of Existing PowerShell Functions with SAPIEN PowerShell Studio 2016

This blog article will demonstrate how to write a GUI on top of your existing PowerShell functions using SAPIEN PowerShell Studio 2016. I’ve previously written a couple of functions for managing SQL Server agent jobs. These two functions, Get-MrSqlAgentJobStatus and Start-MrSqlAgentJob can be found in my SQL repository on GitHub. Launch PowerShell Studio. Select file, the arrow next to new, and new form: ](/images/2016/11/sqlagent-gui1a.pngsqlagent-gui1a) For this particular GUI, I’ll select the “Dialog Style Template” since I want a fixed border without any minimize or maximize buttons:

PowerShell Function to Check the Status of a SQL Agent Job using the .NET Framework

My previous blog article demonstrated how to start a SQL agent job using the .NET Framework from PowerShell to eliminate the dependency of needing the SQL Server PowerShell module or snap-in on the machine where the command is being run from. There’s not much use of blindly starting a SQL agent job without being able to check the status of it so I decided to write another function to accomplish that task.

Start a SQL Agent Job with the .NET Framework from PowerShell

As of this writing, the most recent version of the SQLServer PowerShell module (which installs as part of SQL Server Management Studio) includes cmdlets for retrieving information about SQL agent jobs, but no cmdlets for starting them. Get-Command -Module SQLServer -Name *job* I recently ran into a situation where I needed to start a SQL agent job from PowerShell. The solution needed to be a tool that others could use who may or may not have the SQLServer module, SQLPS module or older SQL Server snap-in installed.


Webinar: Automate Operational Readiness and Validation Testing of SQL Server with PowerShell and Pester

I’ll be presenting a webinar on how to “Automate Operational Readiness and Validation Testing of SQL Server with PowerShell and Pester” for the PowerShell Virtual Chapter of SQL PASSon Wednesday, November 16th at 11am CST. ](/images/2016/11/psvcsqlpass111616.pngpsvcsqlpass111616)How do you know whether or not all of the SQL Servers in your environment are configured based on your organizations standards? How do you know whether or not they are all operating properly when maintenance is performed on the systems in your environment?

PowerShell Function to Validate Both IPv4 and IPv6 Addresses

Last week, I wrote a blog article about the IP address type accelerator in PowerShell not being 100% accurate and I demonstrated using it for parameter validation. If you want to simply validate an IP Address and return a Boolean, that’s a little more complicated so I decided to write a function to perform that task along with providing detailed information about the IP address when an optional detailed parameter is specified:

PowerShell IP Address Type Accelerator Not 100% Accurate

Testing whether or not an IP Address is valid with PowerShell is a fairly simple process with the [ipaddress] type accelerator if your goal is to validate input for a script or function as shown in the following code example: function Test-ValidInput { [CmdletBinding()] param ( [ipaddress]$IpAddress ) Write-Output $true } When a valid IP address is specified, the function continues and when an invalid IP address is specified, the function terminates immediately and returns an error message:

PowerShell Function to Determine Available Drive Letters

I’ve recently been working on some file server drive migrations. One of the steps I needed to perform was to change the drive letter of a current drive to a different available drive letter so I decided to write a PowerShell function to accomplish the task of determining what drive letters are available. The Get-MrAvailableDriveLetter function shown in the following code example will run on systems with PowerShell version 2.0 or higher (I tested it all the way down to version 1.

Create a Certificate to Encrypt MOF Passwords that’s Compatible with DSC in PowerShell version 5.0

I’ve previously written a blog article titled “Use a certificate with PowerShell DSC to add a server to Active Directory without hard coding a password” where I had created a certificate that was used to encrypt the password in a PowerShell version 4 DSC (Desired State Configuration) MOF file. The same procedure in PowerShell v5 generates an error stating the certificate cannot be used for encryption: ConvertTo-MOFInstance : System.ArgumentException error processing property ‘Password’ OF TYPE ‘MSFT_Credential’:Certificate ‘6EBFB5C88AB4B8C9E3B8E30E88A5D071D6735464’ cannot be used for encryption.

Simplifying my PowerShell version 5 Class Based DSC Resource for Configuring Remote Desktop

Last week I wrote a blog article about a PowerShell Desired State Configuration Class Based Resource for Configuring Remote Desktop. Since then I’ve discovered and learned a couple of new things about enumerations in PowerShell that can be used to simply the code even further. My original code used a couple of enumerations which I’ve removed to show how they can be used to further simply the code: class RemoteDesktop { [DscProperty(Key)] [string]$UserAuthenication [DscProperty(Mandatory)] [string]$Ensure [RemoteDesktop]Get() { $this.

PowerShell Desired State Configuration Class Based Resource for Configuring Remote Desktop

Prior to PowerShell version 5 being released, I had written a PowerShell version 4 compatible DSC (Desired State Configuration) resource named cMrRDP for configuring Remote Desktop. It can be found in my DSC respository on GitHub. The recommendation at that point was to use the letter “c” as the prefix for community created DSC resources. The current recommendation is to no longer use the “c” prefix for DSC resources. Steven Murawski wrote a blog article titled DSC People - Let’s Stop Using ‘c’ Now that I recommend taking a look at.

Store and Retrieve PowerShell Hash Tables in a SQL Server Database with Write-SqlTableData and Read-SqlTableData

In my blog article from last week, I demonstrated using several older open source PowerShell functions to store the environmental portion of the code from operational validation tests in a SQL Server database and then later retrieve it and re-hydrate it back into a PowerShell hash table. Earlier this week, a new release of the SQLServer PowerShell module was released as part of SSMS (SQL Server Management Studio): It includes three new cmdlets, two of which can be used to store and retrieve data in a SQL Server database from PowerShell instead of the older open source ones that I demonstrated in the previously referenced blog article from last week.

Store Environmental Code in a SQL Server Database for PowerShell Operational Validation Tests

I’ve previously published articles on separating environmental code from structural code for both DSC (Desired State Configuration) and Operational Validation or Readiness Tests. This article picks up where I left off last week in Separating Environmental Code from Structural Code in PowerShell Operational Validation Tests. As many existing open source PowerShell functions as possible have been used in the examples shown in this blog article instead of re-inventing the wheel and rewriting everything from scratch.

Separating Environmental Code from Structural Code in PowerShell Operational Validation Tests

Do you ever feel like you’re writing the same operational validation or readiness test over and over again? I’m not sure about you, but I don’t like repeating myself by rewriting the same code because it creates a lot of technical debt. There has to be a better way . Why not take the same thought process from DSC (Desired State Configuration) and separate the environmental portion of the code from the structural portion and apply it to operational tests so the same or similar code isn’t repeated over and over again?

Use PowerShell and Pester for Operational Readiness Testing of Altaro VM Backup

I’ve recently been working with Altaro VM Backup and I must say that I’ve been very impressed with the ease and simplicity of the product. The back-end portion of the product can run on a virtual or physical server with or without the GUI (Server Core is supported). It can backup to just about any type of drive (local disk, UNC path, USB drive, etc). It doesn’t require SQL Server. In my environment, adding a Hyper-V server (running Windows Server 2012 R2) installed a service on the Hypervisor, but did not require a reboot.

Learning Existing and Setting Up New Keyboard Shortcuts in Visual Studio Code for the PowerShell Enthusiast

I’ve recently made myself start using Visual Studio Code for writing some of my PowerShell code and I thought I would share a few of the tips that I’ve learned. If you haven’t read my blog article titled “Use the PowerShell Console from within Visual Studio Code”, I definitely recommend taking a look at it as today’s blog article assumes that you’ve already made those modifications to your Visual Studio Code environment.

Speaking on PowerShell Toolmaking this weekend at {dev = data} DAY Birmingham 2016

I’ll be presenting a session on PowerShell Toolmaking with Advanced Functions and Script Modules this Saturday, August 20th at {dev = data} DAY Birmingham 2016. Here’s what you can expect from my session: “Transitioning from writing PowerShell one-liners and basic scripts to creating reusable PowerShell tools with advanced functions and script modules can be a daunting task and with all the different ways that you’ll find on the Internet to accomplish the same task, it can definitely seem overwhelming.

Use the PowerShell Console from within Visual Studio Code

I recently revisited Visual Studio Code. I was looking for a markdown editor and remembered seeing a tweet a few weeks ago saying that VS Code could be used to edit markdown. It supports markdown by default, although I would recommend adding a spell check extension to it. I thought that it would be convenient if I could write my PowerShell code right from within the same interface that I’m writing other things such as markdown.

Speaking on both PowerShell and DSC at SQL Saturday Baton Rouge 2016 this Weekend!

Although PowerShell has been around for 10 years now, there are still some who are just getting started with it. There are several categories that new comers fit into, some are just starting out in their career, others may be career changers, and others may have been in the industry for a number of years and are finally trying to embrace PowerShell. Regardless of which category you fit into, I’ll be presenting a session on “PowerShell Fundamentals for the Absolute Beginner” at SQL Saturday #515 in Baton Rougethis Saturday, August 6th.

Something to -notlike about the -like operator in PowerShell

I recently ran into a problem with the PowerShell like operator that I wanted to share since what’s occurring may not be immediately apparent. The like operator allows for comparison tests of strings using wildcard characters instead of exact matches. I think of it being similar to the match operator except like uses simple wildcards instead of regular expressions. 'Microsoft Windows 10 Enterprise' -like '*Windows 10*' Easy enough, right? A string on the left and another string with wildcards on the right.

Automatically place an Android Phone on Vibrate at Work

Whether or not your place of employment requires that your cellphone be placed on silent or not while in the office, it’s simply a common courtesy to prevent interruptions and distractions to your co-workers when your twenty-seven different social media, email, phone, voicemail, and shopping applications that are installed on your phone constantly chime or play your favorite song every thirty seconds. The problem is, who can remember to silence their phone after arriving in the office before it makes a half dozen or so of these sounds and while a half dozen notifications may not sound like a big deal compound them by a hundred or more people in the office and it has become a major problem in society, especially when your co-workers within hearing distance are on business calls with customers.

PowerShell function for creating a PowerShell function template

A couple of weeks ago I published a blog article PowerShell function for creating a script module template and I thought I would follow-up that article with the same type of function for creating a PowerShell function template. Instead of having to remember things like checking to make sure an approved verb is used, that a Pester test is created, and comment based help is entered in the right format, a template such as the one shown in the following code example can make your life much simpler.

Renewed for another year as a Microsoft MVP

I received notification last Friday, July 1st that I’ve been renewed for another year as a Microsoft MVP. This is my third MVP award, two as a PowerShell MVP and now one as a Cloud and Datacenter MVP. ](/images/2016/07/mvp2016.jpgmvp2016)Although I’m now considered a Cloud and Datacenter MVP due to the changes to the Microsoft’s MVP program, my focus is still PowerShell. I look forward to seeing my fellow MVP’s at the MVP Summit again later this year.

PowerShell function for creating a script module template

I’m curious to know what process others use to create new PowerShell script modules? Since the initial process of creating a PowerShell script module seems redundant and tedious, I decided to create a function that creates a template for new script modules that I create which includes creating both the script module PSM1 and manifest PSD1 files and filling in the information that I would normally include: function New-MrScriptModule { <# .

Learn Building Unconventional SQL Server Tools in PowerShell this weekend at SQL Saturday Chattanooga 2016

I’m presenting a session on Building Unconventional SQL Server Tools in PowerShell this weekend at SQL Saturday #498 in Chattanooga. Ever had records from a SQL Server database table come up missing? Maybe someone or some process deleted them, but who really knows what happened to them? Wouldn’t it be awesome to create a free tool with PowerShell that automates the task of sifting through the transaction log backups and even the active transaction log to determine when deletes occurred for a specific database and what user deleted those records along with the Log Sequence Number that the database needs to be restored to so the missing records can be recovered?

PowerShell function to find information about module updates

I decided to update the one liner from my blog article last week and take it a step further by turning it into a reusable tool that displays information about module updates that are available regardless of where they were installed from. #Requires -Version 3.0 -Modules PowerShellGet function Find-MrModuleUpdate { <# .SYNOPSISFinds updates for installed modules from an online gallery that matches the specified criteria. .DESCRIPTIONFind-MrModuleUpdate is a PowerShell advanced function that finds updates from an online gallery for locally installed modules regardless of whether or not they were originally installed from an online gallery or from the same online gallery where the update is found.

Update Manually Installed PowerShell Modules from the PowerShell Gallery

There are PowerShell modules that ship with Windows 10 that weren’t installed from the PowerShell Galleryusing PowerShellGetso they can’t be updated using the Update-Module cmdlet. This also applies for any modules that you’ve installed manually yourself. The following PowerShell script retrieves a list of the most recent version of the modules in the all users path for PowerShell modules. It determines which ones weren’t installed using PowerShellGet based on the hidden xml file that would exist in the module directory and then it determines if a newer version exists in one of the PowerShell Galleries that’s registered on your computer:

Learn PowerShell Desired State Configuration from the Trenches this weekend at SQL Saturday Pensacola 2016

I’m presenting a session on PowerShell Desired State Configuration from the Trenchesthis weekend at SQL Saturday #491 in Pensacola. There are lots of things to consider when configuring systems in your on-premises datacenters with Desired State Configuration depending on what the state of your current environment is, whether or not DSC will be configured to apply and monitor or apply and autocorrect configuration drift, and whether or not you’ll be using push or pull configuration mode.

Video: PowerShell Toolmaking with Advanced Functions and Script Modules

I presented a session on PowerShell Toolmaking with Advanced Functions and Script Modulesthis past weekend at SQL Saturday #521in Atlanta. I decided to make an attempt to record my session which was presented live in front of a packed room full of attendees: The recording turned out very well considering I used the built-in laptop microphone and I moved around during my presentation. The audio levels have been tweaked because they were often too low depending on how far away I was from the computer at any given point in time during the presentation.

Learn PowerShell Toolmaking with Advanced Functions and Script Modules this weekend at SQL Saturday Atlanta 2016

I’ll be presenting a session on PowerShell Toolmaking with Advanced Functions and Script Modulesthis weekend at SQL Saturday #521 in Atlanta. Transitioning from writing PowerShell one-liners and basic scripts to creating reusable PowerShell tools with advanced functions and script modules can be a daunting task and with all the different ways that you’ll find on the Internet to accomplish the same task, it can definitely seem overwhelming. During this session, PowerShell MVP Mike F Robbins will demystify many of the intricacies of toolmaking while demonstrating the best practices for using parameters, parameter validation, cmdlet binding, supports should process, pipeline input, error handling, module manifests, and custom formatting.

Why isn’t Test Driven Development more widely adopted and accepted by the PowerShell community?

We’ve all heard that TDD (Test Driven Development) means that you write unit tests before writing any code. Most of us are probably writing functional or acceptance tests after the fact because the idea of Test Driven Development isn’t clearly defined, at least not in my opinion. I originally thought it meant to write thorough unit tests to test all functionality for a specific piece of code such as a PowerShell function from start to finish before writing any of the production code for the function itself.

Don’t use Default Manifest Settings when Dot-Sourcing Functions in PS1 Files from a PowerShell Script Module

I briefly mentioned and demonstrated something similar to this at the end of one of my sessions at the PowerShell and DevOps Global Summit 2016. Since then, I’ve tested more which has led to a better solution. We’ve all been taught that it’s best practice to use a #Requiresstatementin our functions that specifies the required PowerShell version along with any module dependencies, but following this best practice has one unexpected side effect when dot-sourcing functions in PS1 files from a PSM1 script module.

Be Mindful of Object Types when Writing Unit Tests and Performing Operational Validation in PowerShell with Pester

I recently wrote a Pester test that performs some basic operational validation (smoke tests) of SQL Servers. I’ve previously written similar tests as functions as shown in my Write Dynamic Unit Tests for your PowerShell Code with Pester blog article, but I decided to write this one as a script with the naming convention that seems to be recommended. The name of this particular test is “Validate-MrSQLServer.Tests.ps1”. You’re probably thinking “Validate” isn’t an approved verb and you’re right, but this isn’t a function, it’s a script.

Keeping Track of PowerShell Functions in Script Modules when Dot-Sourcing PS1 Files

I’m picking up where I left off in a previous blog article “Write Dynamic Unit Tests for your PowerShell Code with Pester”. I’m using the dynamic Test-MrFunctionsToExport Pester test that I wrote about in that previous blog article. Currently, the test is failing for my MrToolkit module that’s part of my PowerShell repository on GitHub: Test-MrFunctionsToExport -ManifestPath .\GitHub\PowerShell\MrToolkit\MrToolkit.psd1 Based on the previous results, I can easily determine that more functions exist in the module folder than are specified in the FunctionsToExport section of the module manifest.

Video: Creating a Custom PowerShell Toolkit to Demystify DSC

Last week, on Monday (April 4th, 2016), I presented a session at the PowerShell and DevOps Global Summit 2016 on “Creating a Custom PowerShell Toolkit to Demystify the Intricacies of Desired State Configuration”. The video from that presentation is now available: Here’s the abstract or synopsis for this presentation: “DSC (Desired State Configuration) can be very complicated when working in an environment where nodes are set to retrieve their configuration from a pull server.

Video: Building Unconventional SQL Server Tools in PowerShell

Last week, on Wednesday (April 6th, 2016), I presented a session at the PowerShell and DevOps Global Summit 2016 on “Building Unconventional SQL Server Tools in PowerShell with Functions and Script Modules”. The video from that presentation is now available: Here’s the abstract or synopsis for this presentation: “Have you ever had records from a SQL Server database table come up missing? Maybe someone or some process deleted them, but who really knows what happened to them?

Write Dynamic Unit Tests for your PowerShell Code with Pester

I wrote a blog article on: “PowerShell Script Module Design: Placing functions directly in the PSM1 file versus dot-sourcing separate PS1 files” earlier this year and I’ve moved all of my PowerShell script modules to that design and while today’s blog article isn’t part of a series, that previous one is recommended reading so you’re not lost when trying to understand what I’m attempting to accomplish. Most unit tests that I’ve seen created with Pester for testing PowerShell code are very specific, the tests generally have hard coded values in them, and live in source control along with the code that they’re designed to test.

A Rant about some Blogs, Magazine Articles, Books, Training Videos, Presentations, Etc

I find it funny, yet sad that I often see blogs, magazine articles, books, training videos, presentations, etc where the author says something to the effect of “Never do ”. Then they proceed by doing exactly what they just said not to do like four-hundred times throughout their book, blog, etc. and when asked about it, the author says “Oh, that’s only acceptable for demonstration purposes”. I also see this in the form of an author saying something to the effect of “You can do everything with ” and then they proceed by saying “Hold on for a second while I prep my demo by pointing and clicking in the GUI (Graphical User Interface) or some technology other than what they said you could do everything in”.

Converting a SQL Server Log Sequence Number with PowerShell

As demonstrated in one of my previous blog articles Determine who deleted SQL Server database records by querying the transaction log with PowerShell, someone or something has deleted records from a SQL Server database. You’ve used my Find-MrSqlDatabaseChange function to determine when the delete operation occurred based on information contained in either transaction log backups or the active transaction log: Find-MrSqlDatabaseChange -ServerInstance SQL01 -Database pubs -StartTime (Get-Date -Date '03/28/2016 14:55 PM') You’re ready to perform point in time recovery of the database to the LSN (Log Sequence Number) just before the delete occurred but the LSN provided from the transaction log is in a different format than what’s required to perform a restore of the database.

Pro Tips from the Trenches: The Resolve-Path PowerShell cmdlet

You’re designing a reusable tool in PowerShell and decide a function is the most appropriate type of command to accomplish the task at hand. It will accept a FilePath parameter which will be used to specify both the path and filename to a destination file. The path should already exist, but the file may or may not already exist. For simplicity, I’ve stripped away the complexity so the problem is more apparent.

Run 350 Nano Server Virtual Machines on a Lenovo ThinkPad P50 with Hyper-V in Windows 10

If you’re a frequent reader of my blog articles on this site, then you’re already aware that I recently purchased a Lenovo ThinkPad P50with a Xeon CPU, 64 GB of RAM, and upgraded it to SSD hard drives as shown in my previous blog article. I tweetedthat it wouldn’t be complete without a few PowerShell stickers: ](/images/2016/03/p50-stickers.jpgp50-stickers)I received a response from Jeffrey Snoverwanting to know how many Nano server VM’s could be run on it:

Upgrade to SSD Hard Drives in a Lenovo ThinkPad P50

I recently purchased a Lenovo ThinkPad P50. It’s certainly not the sleekest machine on the market, but don’t judge a book by its cover. I picked this model because it offers an Intel Xeon CPUand up to 64 GB of RAM in a 15 inch laptop. My previous computer was a Dell Latitude e6530 which is about the same form factor, although the older one is a little thicker and slightly larger and heavier due to the extended battery that sticks out of the back of it.

Determine the Packt Publishing Free eBook of the Day with PowerShell

First of all, let me state that I’m in no way affiliated with Packt Publishingother than being a customer. They offer a free eBook each dayand that information is freely available on the Internet. Like any information on the web, it’s publicly available and you can read it with a web browser or with something like PowerShell. As shown in the following example, a PowerShell one liner can be used to determine their free eBook of the day:

Use PowerShell to Add Active Directory Users to Specific Groups based on a CSV file

I recently responded to a post in a forum about adding Active Directory users to groups with PowerShell based on information contained in a CSV (Comma Separated Values file format). I thought I would not only share the scenario and solution that I came up with but also elaborate on adding additional functionality that may be desired. In this scenario, you’ve been provided with a CSV file that contains a list of Active Directory users and the groups that they should be a member of as shown in the following image:

Git status doesn’t know if your local repository is out of date

To setup the scenario that will be demonstrated in this blog article, a new commit has been pushed to the dev branch of my PowerShell repository on GitHub from a computer named PC01. Then I switched over to using to an alternate computer named PC02 that was up to date prior to that latest commit being pushed to GitHub from PC01. This means that the dev branch of the PowerShell repository on PC02 is one commit behind the remote origin on GitHub.

Configuring the PowerShell ISE for use with Git and GitHub

The goal of this blog article is to configure the PowerShell ISE (Integrated Scripting Environment) so the management of Git version control can be performed from it. Most tutorials you’ll find will attempt to lead you down the path of using SSH instead of HTTPS to synchronize your repositories to GitHub from the command-line but that’s really over-complicated and unnecessary if you’re using a Windows based machine. The client machine used in this blog article runs the 64 bit version of Windows 10 Enterprise Edition.


How to install the new preview version of the PowerShell ISE

The PowerShell team released a new preview version of the PowerShell ISE (Integrated Scripting Environment) this week. This is the first time a new version of the PowerShell ISE has been released separately from a new version of the WMF (Windows Management Framework). This new approach reminds me of how they shipped the help separately from the WMF beginning with PowerShell version 3.0. ](/images/2016/01/isep.pngisep)Best of All, this new preview version of the ISE is a module which is distributed via the PowerShell Galleryand installing it doesn’t interfere with the current version of the ISE so there’s no chance of hosing up the development of any mission critical work that you may be working on.

Getting Started with the Git Version Control System – Part 2

In my last blog article, I demonstrated a few Git basics which were all performed on a local repository. Today I’ll pick up where I left off in that blog article and clone my local MrSQL repository to a file server so others can clone it to their machine from there. Git is a distributed version control system and others could simply clone the repository to their machine directly from mine but placing it on a server will give us a more centralized location that’s backed up and one that will always be available to other users.

Getting Started with the Git Version Control System

There’s a lot to Git and there’s tons of information all over the web about it. There’s so much information out there that you might feel overwhelmed when you first start trying to learn what Git is and how to use it. The purpose of this blog article is to help you install Git, teach you a few basics, and point you in the right direction to learn more. I’ll start with a little background information: Back in 2009 when I started blogging on this site, I used the TechNet script repository to share my PowerShell code that I wrote about in my blog articles.

#PowerShell Script Module Design: Placing functions directly in the PSM1 file versus dot-sourcing separate PS1 files

So you’ve transitioned from writing PowerShell one-liners and scripts to creating reusable tools with functionsand script modules. You may have started off by simply placing your functions in a PS1 file and dot-sourcing it. That leaves a lot to be desired though since it’s a manual process and even if you’ve added some code to your profile to accomplish that task, the experience still isn’t as good as it could be.

Building logic into PowerShell functions to nag users before their Active Directory password expires

This week I’m sharing a couple of PowerShell functions that are a work in progress to nag those users who seem to never want to change their passwords. I can’t tell you how many times the help desk staff at one of the companies that I provide support for receives a call from a user who is unable to access email or other resources on the intranet. The problem? They have run their password down to the point where they arrive in the morning, log into their computer without issue, and during the day while they’re working their password expires which cuts them off from Intranet resources such as email and websites that require authentication.

Video: Demystifying Active Directory User Account Lockouts with PowerShell

A few months ago I created an audition video for Pluralsight on “Demystifying Active Directory User Account Lockouts with PowerShell” and I thought I would share that video with you, the readers of my blog site: You can also find this videoon my YouTube channel. Happy New Year! µ

Use PowerShell to Determine Services with a StartType of Automatic or Manual with Trigger Start

Newer Windows operating systems have numerous services that are set to start automatically or manually with a triggered start. The following image is from a machine that’s running Windows 10 Enterprise Edition (version 1511): ](/images/2015/12/trigger-start-service1a.jpgtrigger-start-service1a) The problem is when you’re trying to determine whether or not all of the services that are set to start automatically are running or not. These trigger start services can’t be filtered out using the Get-Service cmdlet or with WMI and they aren’t necessarily suppose to be running.

StartType property added to Get-Service in PowerShell version 5 build 10586 on Windows 10 version 1511

If you’ve used PowerShell for more than 5 minutes, then you probably have some experience with the Get-Service cmdlet. As you could have guessed if you didn’t already know, the Get-Service cmdlet retrieves information about Windows services. Depending on what you’re trying to accomplish, that particular cmdlet could leave a lot to be desired. Want to know if a service is running? No problem. Want to know what the startup type is for one or more services?

Video: Create Dynamic Reusable Tools in PowerShell with Advanced Functions

Last Thursday I presented a session for the Central Texas PowerShell Users Group on “DRY: Create Dynamic Reusable Tools in PowerShell with Advanced Functions”. The video from that presentation is now available: The presentation materials including the code and a PDF copy of the slide deck can be downloaded from here. µ

Central Texas PowerShell User Group Meeting Tonight!

This evening at 6pm central time, I’ll be presenting a session on “DRY: Create Dynamic Reusable Tools in PowerShell with Advanced Functions” for the Central Texas PowerShell User Group. You can signup and find out more details about this presentation here. Here’s what to expect from the session: “Bad habits never die. Writing the same PowerShell code over and over again with static values is no different than pointing and clicking in the GUI performing the same task over and over again.

Installing Visual Studio Code and the PowerShell Extension

Last week Microsoft released a new version of Visual Studio Code along with an extension for writing PowerShell in it. Visit code.visualstudio.comto download Visual Studio Code. There’s also an update link on that page if you happen to have a version prior to “0.10.1”. The PowerShell extension for Visual Studio Code only works with PowerShell version 5. Either Windows 8.1 with the WMF 5 Production Previewinstalled or Windows 10 is sufficient.

Using PSScriptAnalyzer to check your PowerShell code for best practices

Are you interested in learning if your PowerShell code follows what the community considers to be best practices? Well, you’re in luck because Microsoft has a new open source PowerShell module named PSScriptAnalyzer that does just that. According to the GitHub page for PSScriptAnalyzer, it’s a static code checker for PowerShell modules and scripts that checks the quality of PowerShell code by running a set of rules that are based on best practices identified by the PowerShell team and community.

Using Pester and the Operation Validation Framework to Verify a System is Working

If you haven’t seen the Operation Validation Frameworkon GitHub, it’s definitely something worth taking a look at. This framework allows you to write Pester tests to perform end-to-end validation that a system is operating properly. Pester is typically used to perform test driven developmentor unit testingon your PowerShell code, but in this scenario it’s used for operational testing. You need to have Pesterinstalled, but if you’re running Windows 10 then you already have Pester.

Solving DSC Problems on Windows 10 & Writing PowerShell Code that writes PowerShell Code for you

I recently ran into a problem with DSC on Windows 10 when trying to create MOF files with DSC configurations that work on other operating systems. An error is generated when the friendly name for a DSC resource contains a dash and that friendly name is specified as a dependency for another resource. I know that only certain characters are allowed in the name that’s specified for DependsOn and I’ve run into similar problems with things such as IP addresses due to the dot or period, but the dash works in other operating systems at least with the production preview of PowerShell version 5, but not with the version of PowerShell version 5 that ships with Windows 10:

Video & Presentation Materials: October Omaha PowerShell User Group Meeting

This past Tuesday, I presented a session on “Using PowerShell Desired State Configuration in your On-Premises Datacenter” for the Omaha PowerShell User Group. During that presentation I demonstrated a number of the tips and tricks that I’ve learned while implementing systems in multiple data-centers using DSC. The meeting was recorded and the video from it is now available: You can download a PDF copy of the slide deck along with both of the scripts used during the presentation from here.

Using Pester to Test PowerShell Code with Other Cultures

I recently published a blog article on unexpected case sensitivity in PowerShell. An example in that blog article uses the contains method which is indeed case sensitive. One of the workarounds that I demonstrated was to convert whatever the user entered to upper case using the ToUpper() method. One of the reasons I like blogging is that many times there are things that I may not have considered and sometimes things that I wasn’t even aware of so in addition to sharing my knowledge with others, I often times learn in the process based on the feedback I receive about my blog articles and this was one of those times.

Some Cases of Unexpected Case Sensitivity in PowerShell

I’m sure that you’ve all heard that PowerShell is case insensitive, right? Most things in PowerShell are indeed case insensitive and what is case sensitive is normally expected behavior, but I’ve come across a number of things in PowerShell that are case sensitive that don’t work as I would expect them to which are listed in this blog article. One of the first things that I discovered in PowerShell that is case sensitive that you wouldn’t have thought would be is the Region keyword that was introduced in PowerShell version 3:

Announcing the Winner of the PowerShell TFM Book Contest

Two weeks ago, I started a PowerShell contest which required the participants to convert a string of text to title case. I didn’t specifically say title case but I explained that the first letter of each word should be converted to upper case and all remaining letters in each word should be converted to lower case. This was because a search on how to convert to title case with PowerShell gave away a good portion of the answer.

Code and Slides from my sessions at SQL Saturday 439

Today I presented two wildly successful sessions at SQL Saturday #439 in Columbus, GA. The code and slides from my “How do I Get-Started with PowerShell?” session can be downloaded here and the code and slides from my “PS C:> Get-Started -With PowerShell Desired State Configuration” session can be downloaded here. The custom functions that are referenced in the code from the DSC session can be downloaded as part of my MrDSC modulefrom GitHub.

PowerShell: Filter by User when Querying the Security Event Log with Get-WinEvent and the FilterHashTable Parameter

I recently ran across something interesting that I thought I would share. The help for the FilterHashTable parameter of Get-WinEvent says that you can filter by UserID using an Active Directory user account’s SID or domain account name: help Get-WinEvent -Parameter filterhashtable Notice that the help also says the data key can be used for unnamed fields in classic event logs. I often hear the question wanting to know what the valid key pairs are for the hash table.

Windows PowerShell TFM Book Contest and Giveaway

](/images/2014/12/powershell-tfm4_cover150.jpgpowershell-tfm4_cover150)Today is the first day of Autumnalso known as fall here in North America and it’s my favorite time of the year. If nothing else, you’ve got to love the cooler weather and the changing of tree leaf colors. Last fall, a new version of the Windows PowerShell TFMbook that I co-authored along with Jason Helmickwas published and strangely enough, its design is remarkably similar to the colors that are associated with Autumn.

Working around UAC (User Access Control) without running PowerShell elevated

We’ve all heard it and experienced the problem where you can’t perform tasks such as stopping a service on the local machine with PowerShell unless your running PowerShell elevated. If the title bar doesn’t say “Administrator” then you’ll end up with these types of error messages: Stop-Service -Name BITS -PassThru If PowerShell remoting is enabled on the local machine, you can simply remote back into it to perform the task without having to run PowerShell elevated:

Video & Presentation Materials: September 2015 PowerShell.org Advanced Functions TechSession Webinar

Last week I presented a session titled “The Top 10 Considerations When Writing PowerShell Advanced Functions” for the September 2015 PowerShell.org TechSession Webinar. The video from that presentation is now available: [youtube=https://youtu.be/tcAz4T1Aydo] The presentation materials including the code and slides can be downloaded from here. I received a question during the presentation about how to determine what the type accelerators are and the answer to that question can be found in this Hey, Scripting Guy!

#PowerShell: DelayedAutoStart Property added to the Win32_Service WMI Class in Windows 10 RTM

I recently discovered that Windows 10 adds a DelayedAutoStart property to the Win32_Service WMI Class: Get-CimInstance -ClassName Win32_Service -Filter "Name = 'MapsBroker'" | Format-List -Property * I’ve verified that this property does not exist on prior operating systems such as Windows 8.1 even when they’re updated to the production preview version of PowerShell version 5. I had written a Hey, Scripting Guy! Blog article on how to query the registry of remote machines to “Exclude Delayed Start Services when Checking Status with PowerShell” that shows how to retrieve the necessary information to accomplish this task on other OS’s, but it’s nice to see that Microsoft has finally made this information easier to retrieve.

#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: $MyVar = 'Bits', 'W32time' Invoke-Command -ComputerName DC01 { Get-Service -Name $Using:MyVar } 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?

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 https://www.telize.com/geoip and your goal is to write some PowerShell code to display output similar to the following: longitude latitude continent_code timezone --------- -------- -------------- -------- -115.

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 Owentook this photo as I was preparing for my session: Another fellow PowerShell MVP, Jonathan Walzof 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 approximately the first 43 minutes of this video:

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:

DSC session at Atlanta TechStravaganza one week from today!

Have you seen the awesome lineup of speakers and sessions for Atlanta TechStravaganzathis year? Mark Minasiis the keynote speaker and there’s an all day dedicated PowerShell trackwhere Ed (The Scripting Guy) Wilsonwill 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 my presentation at that event:

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. Invoke-Command -ComputerName (Get-Content -Path C:\MyServers.txt) { $NICs = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled = 'true' and DHCPEnabled = 'False'" | Where-Object {$_.ipaddress -like '192.168.0.*'} foreach ($NIC in $NICs){ $ip = $NIC.

My Solution: July 2015 PowerShell Scripting Games Puzzle

Last month, PowerShell.organnounced 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.

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: Get-ADUser -Identity mikefrobbins 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 a viable solution in PowerShell.

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. ](/images/2013/07/sqlsatbr.jpgsqlsatbr)The code and slides that I used during my “PS C:> Get-Started -With ‘PowerShell for SQL Server’” presentation can be downloaded from hereand 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 SQL and DSC repositories on GitHub.

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 deduplicationfeature 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 desktop operating systems since it can save an enormous amount of space.

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: function New-MrGuid { $Guid = [System.Guid]::NewGuid() Return $Guid } 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: function New-MrGuid { $Guid = [System.

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.

Query SQL Server from PowerShell without the SQL module or snapin

There are several different ways to query a SQL Server from PowerShell but most often you’ll find that they’re dependent on the SQL PowerShell module or snapin. To eliminate that dependency, you can query a SQL Server from PowerShell using the .NET framework. There are several different options to accomplish this including using a DataReader or a DataSet and there are plenty of tutorials on those topics already on the Internet so there’s no reason to duplicate that information here.

PowerShell $Profile: The six options and their precedence

There are a total of six different profiles than can be created in PowerShell by default. Four of them can exist that are applied to the PowerShell console: $PROFILE | Format-List -Force And four of them can also exist that are applied to the PowerShell ISE (Integrated Scripting Environment): $profile | Format-List -Force Two of the profiles are the same between the PowerShell console and ISE which gives you a total of six possible profile combinations that can be used to load items when you start PowerShell depending on if you want it to load for all users or for the current user and for all hosts or for the current host.

Renewed as a Microsoft MVP on Windows PowerShell for 2015

I received the official notification earlier today confirming that I’ve been renewed as a Microsoft MVP on Windows PowerShellfor 2015: I would like to thank everyone who has helped me along the way! Here’s to another year of writing more awesome blogs on this site as well as guest blogs for other sites, speaking at conferences and for user groups, and running the Mississippi PowerShell User Group. µ

Function to Import the SQLPS PowerShell Module or Snap-in

The SQL Server 2014 basic management tools have been installed on the Windows 8.1 workstation that’s being used in this blog article. When attempting to import the SQLPS (SQL Server PowerShell) module on your workstation, you’ll be unable to import it and you’ll receive the following error message if the PowerShell script execution policy is set to the default of restricted: Import-Module -Name SQLPS _Import-Module : File C:\Program Files (x86)\Microsoft SQL Server\120\Tools\PowerShell\Modules\SQLPS\Sqlps.

Walkthrough: An example of how I write PowerShell functions

A couple of days ago I posted a blog article titled “PowerShell function: Test-ConsoleColorprovides a visual demonstration of the foreach scripting construct” and today I thought I would walk you through that function step by step since it’s what I consider to be a well written PowerShell function. It starts out by using the #Requiresstatement to require at least PowerShell version 3 or it won’t run. It also requires that the PowerShell Community Extensionsmodule be installed since it uses a function from that module and continuing without it only leads to errors:

Video: PS C:\> Get-Started -With ‘PowerShell for SQL Server’

I presented a beginner level session for the PowerShell Virtual Chapter of PASSyesterday titled “PS C:> Get-Started -With ‘PowerShell for SQL Server’". The session is entry level PowerShell and designed for those people who haven’t yet embraced PowerShell because I often hear “How do I get started with PowerShell”? My new answer: Watch this video. The first two thirds or so of the presentation is more or less generic because the basics for someone who is just getting started with PowerShell are the same regardless of what product you’re using it with.

PowerShell function: Test-ConsoleColor provides a visual demonstration of the foreach scripting construct

Test-ConsoleColor is a PowerShell function that I recently wrote to provide a visual demonstration of how to loop through a series of objects in PowerShell using the foreach scripting construct, not to be confused with the ForEach-Object cmdlet. #Requires -Version 3.0 -Modules Pscx function Test-ConsoleColor { <# .SYNOPSISTests all the different color combinations for the PowerShell console. .DESCRIPTIONTest-ConsoleColor is a PowerShell function that by default iterates through all of the possible color combinations for the PowerShell console.

Using a .NET Enumeration for PowerShell Parameter Validation

I recently ran into an issue where I wanted to use the values from a .NET enumeration as the default values for a parameter. That was easy enough: function Test-ConsoleColorValidation { [CmdletBinding()] param ( [ValidateNotNullOrEmpty()] [string[]]$Color = [System.Enum]::GetValues([System.ConsoleColor]) ) $Color } Although the previous code met my initial requirements, I decided that I also wanted the user to be able to tab expand the values and to validate the values based on the list of colors found in the enumeration without a requirement of having to hard code the values.

Get Started with PowerShell for Amazon Web Services

I recently had a guest blog article published on the Hey, Scripting Guy! Blog site on how to “Get-Started with PowerShell for Amazon Web Services”. As referenced in that blog article, the custom PowerShell script module that I wrote for managing AWS storage gateway snapshots can be downloaded from GitHub. If you found that guest blog article interesting, I have another blog article that I’ve written on “Filtering by StartTime with the AWS PowerShell Cmdlets” that you might also be interested in reading.

Presentation materials from the highest rated PowerShell session at SharePoint Saturday Nashville

This past Saturday, I presented a session titled “PS C:> Get-Started -With ‘PowerShell for SharePoint’” at SharePoint Saturday Nashvilleand I’m happy to say that it was the highest rated PowerShell session of the event! How do I know this? Because it was the only PowerShell session of the event :-). The code and slides that I used during my presentation can be downloaded from here. There are multiple scripts included in the zip file and only portions of each one was used during the actual demo.

Get-Started with PowerShell for SQL Server Webinar on Wednesday June 17th

Know of anyone who is interested in PowerShell but not sure how to Get-Started? Next Wednesday, June 17th (One week from today), I’ll be presenting a session on how to “Get-Started with PowerShell for SQL Server” for the PowerShell Virtual Chapter of PASS: ](/images/2015/06/posh4sql.pngposh4sql)The presentation begins at 11am CDT / noon EDT and I hope you’ll join me. This is a beginner (intro) level session which will be presented via a Webinar.

Enough blog articles to read one a day for an entire year!

This blog article today represents a milestone on this blog site as it’s blog article number 365. That means you could read one blog article on this site per day and it would take you an entire year to read all of the articles that are published on this site. I started blogging on this site back in 2009 which was approximately 6 years ago. You’ll notice that I have twelve blog articles from September of 2009, but I actually started blogging earlier that year and copy/pasted many of those first twelve blog articles from another blog site of mine that I had started earlier that year.

Learn how to Get-Started with PowerShell at SharePoint Saturday Nashville on Saturday June 6th

Know anyone who is interested in PowerShell but not sure how to Get-Started? I’m presenting a beginner session at SharePoint Saturday Nashvilleon Saturday, June 6th. Not a SharePoint person? Regardless of whether you’re a SharePoint person or not, the basic fundamentals of PowerShell are the same so most of my session will apply even if you’re not a SharePoint person. ](/images/2015/05/spsnashville2b.jpgspsnashville2b)Don’t have time to learn PowerShell? I hear a lot of people say that they just don’t have time to learn PowerShell.

Presentation Materials from my Desired State Configuration Session at SQL Saturday 392 in Atlanta

This past Saturday, I presented a session titled “PS C:> Get-Started -With ‘PowerShell Desired State Configuration’” at SQL Saturday #392 in Atlanta. The code and slides that I used during the presentation can be downloaded from here. Some of the functions used in the downloadable code are part of my DSC toolkit module that can be downloaded from GitHub. Keep in mind that module is a work in progress. Here’s a list of the items from the “Resources” slide that was shown towards the end of my presentation that I recommended in case you’re interested in learning more about DSC:

Deploy Desired State Configuration Resources with an SMB based Pull Server

So you’ve either downloaded DSC resources from GitHubor you’ve created some DSC resources of your own and the LCM (Local Configuration Manager) on the servers in your environment is set to use an SMB based DSC pull server. To automatically deploy those custom resources with an SMB pull server, they need to be zipped up including their base directory and named “ResourceName_Version.zip”. For example, the xSmbShare DSC resource that can be download from GitHub would be named “xSmbShare_1.

Create a DSC SMB Pull Server with DSC and separate the Environmental Config from the Structural Config

On Saturday May 16th, I’ll be presenting a session titled “PS C:> Get-Started -With ‘PowerShell Desired State Configuration’” at SQL Saturday #392 in Atlanta. One of the things I’ll be demonstrating is a SMB based DSC Pull Server and I figured since it’s a DSC presentation, why not create it with DSC, right? The machines used in this blog article are running Windows 8.1 and Windows Server 2012 R2. Both have the default version of PowerShell installed that shipped with those operating systems which is PowerShell version 4.

Change the Recovery Model of a SQL Server database with the PowerShell SQL PSProvider

I recently set out to change the recovery model of a SQL Server database with PowerShell. There seems to be lots of information available on how to accomplish this task with PowerShell through SMO (SQL Server Management Objects) and using T-SQL wrapped inside the Invoke-Sqlcmd cmdlet. I even found lots of information about how to view the recovery model with the PowerShell SQL Server PSProvider, but when it came to actually changing the recovery model via the PSProvider, there was little if any information about how to accomplish that task.

PowerShellGet: The BIG EASY way to discover, install, and update PowerShell modules

On Tuesday of this week, I presented a session at the PowerShell Summit North America 2015with the same title as this blog article. The video of my session is now available on PowerShell.org’s YouTube channel: [youtube=https://youtu.be/C-kL_6556XQ] The code and slides from the presentation can be downloaded from here. µ

Free eBook on PowerShell Advanced Functions

Recently, a team of independent bloggers who are active in the PowerShell community teamed up to bring you a series of blog articles on advanced functions via an experiment called PowerShell blog week. Those blog articles have now been complied into a free eBook and are downloadable in all of the popular eBook formats. A zip file containing the PDF, MOBI, EPUB, and AZW3 formats can be downloaded from here.

PowerShellGet Session at the PowerShell Summit NA 2015

The PowerShell Summit North America 2015is next week! I’ll be presenting a session on PowerShellGetat 2:30pm on Tuesday, April 21st in the room named Kilimanjaro. The official title for my session is: _PowerShellGet: The BIG EASY way to discover, install, and update PowerShell modules _ ][1] The abstract (or synopsis) for my session will give you a little information about what I plan to cover during the presentation:[ ][1] What process do you currently have in place for sharing PowerShell modules within your organization?

Filtering by StartTime with the AWS PowerShell Cmdlets

I was recently trying to figure out how to return an AWS Storage Gateway snapshot by providing a value for the StartTime property and it wasn’t easy to say the least so I thought I would share my experience to save others the headache of figuring it out. Most of the tutorials you’ll find online show filtering something similar to this: $filter1 = New-Object Amazon.EC2.Model.Filter $filter1.Name = 'volume-id' $filter1.Value.Add('myvolumeid') $filter2 = New-Object Amazon.

PowerShell Advanced Functions: Can we build them better? With parameter validation, yes we can!

This blog article is the second in a series of blog articles that is being written on PowerShell advanced functions for PowerShell blogging week. If you haven’t already read the first article in this series: Standard and Advanced PowerShell functions written by PowerShell MVP Francois-Xavier Cat I recommend reading it also. What is parameter validation? In PowerShell, parameter validation is the automated testing to validate the accuracy of parameter values passed to a command.

The mother of all PowerShell blogs week is coming next week!

Next week, beginning on Monday March 30th, a group of PowerShell MVP’s and/or enthusiasts who write PowerShell related blog articles on a consistent basis will team up to publish a week long series of blog articles on their sites or the site where they blog at. This isn’t a spoiler alert so I’m pleading the fifth when it comes to the details of those blog articles, but based on what the team has already made public, I can tell you that they’re all on one central topic and that topic is PowerShell advanced functions.

Create a New Empty File with the PowerShell Out-File Cmdlet

A few weeks ago I was setting up OpenSSL on a Windows machine and I was following a Linux tutorial which used the “touch” command to create a new empty file. To accomplish the task of creating a new empty file with PowerShell, the most straight forward way is to use the New-Item cmdlet: New-Item -Name EmptyFile.txt -ItemType File I inadvertently discovered another way to create a new empty file with PowerShell which I thought I would share with you guys, the readers of my blog.

Use PowerShell to Create a Linux VM in Azure

In a couple of my previous blog articles, I’ve demonstrated how to create a storage account in Azureand how to create a reserved virtual IP address in Azure. Both of those items will be used in today’s blog article so I recommend reading through those previous blog articles if you haven’t already done so. The goal in this blog article is to build a CentOS based OpenLogic 7.0 VM in Azure except using PowerShell instead using the Azure portal website (GUI):

Automatically create a checksum and publish DSC MOF configuration files to an SMB pull server

You’ve configured one or more DSC (Desired State Configuration) SMB pull servers in your environment. You’ve also configured the target nodes appropriately. One problem that seems to be a constant problem in your environment when authoring and updating DSC configuration files (MOF files) is keeping track of what GUID belongs to which machine and it’s also a common problem to forget to update the corresponding checksum when a configuration file is updated.

Use PowerShell to Create a Reserved Virtual IP Address (VIP) in Azure

By default, the VM’s that you create in Azure will have a dynamic virtual IP address (VIP). Based on this article on Azure, you could simply create a DNS CNAME record for your custom domain and point it to the DNS name that you chose during the creation of your azure VM which should prevent any problems if the virtual IP address happens to change. Maybe you want a reserved virtual IP address for your Azure instance though?

Use PowerShell to create a Storage Account in Azure

You’ll need to sign up for an Azure account if you don’t already have one: https://azure.microsoft.com. There’s a free trial if you want to try it out. One thing I would suggest if you’ve never used Azure is to spend a little time in the GUI (your Azure account’s portal website) learning about it before you start trying to manage it with PowerShell. That’s the same advice I would give to anyone wanting to do something with PowerShell.

Using PowerShell Desired State Configuration to build the first domain controller in your Active Directory forest

If you’re a frequent reader of the blog articles on this site, then you know that I’ve been working on using Desired State Configuration to build my test lab environment that runs as Hyper-V VM’s on my Windows 8.1 computer. If you would like to know the current state of my test environment, see the previous blog article: “Creating a Desired State Configuration Resource for Self Signed Certificates”. The certificate created in last week’s blog has been exported and copied to the Windows 8.

Creating a Desired State Configuration Resource for Self Signed Certificates

For those of you who follow my blog, you know that I’ve been working on using DSC (Desired State Configuration) to fully automate the build of my test environment that runs as Hyper-V VM’s on my Windows 8.1 computer. Last week in my blog article titled “Automate the installation of DSC Resource Kit Wave 9 resources with PowerShell Desired State Configuration”, I demonstrated how to do just that, automate the installation of the Microsoft created DSC resources that are part of the most recent DSC resource kit (wave 9).

Automate the installation of DSC Resource Kit Wave 9 resources with PowerShell Desired State Configuration

Last week, in my blog article titled Creating Hyper-V VM’s with Desired State Configuration I left off with a newly created Hyper-V VM named Test01 that was created with DSC and the specific IP address of that VM was added to my trusted host list. For more details on the current state of this test environment, see that previous blog article. Today I’ll begin configuring the Test01 VM with DSC. This virtual machine will become the first Active Directory domain controller in my test environment.

Creating Hyper-V VM’s with Desired State Configuration

I’m looking to automate the build of my test environment that runs as Hyper-V virtual machines on my Windows 8.1 Laptop computer. To get started, I thought I would take a look at the xHyper-V DSC resource to create the actual VM’s. There’s also no reason this shouldn’t work on a Windows Server that’s running the Hyper-V role. The Hyper-V role has already been added to my Windows 8.1 computer. I also have a previously created virtual hard drive (vhdx) file that has been loaded with the Windows Server 2012 R2 operating system and all of the available Windows updates.

Awarded the SAPIEN MVP Award by SAPIEN Technologies, Inc

I received notification earlier this week that I’ve been awarded the SAPIEN MVP awardfor 2015 by SAPIEN Technologies, Inc. ](/images/2015/01/sapien_mvp.pngsapien_mvp)As many of you know, I co-authored SAPIEN’s Windows PowerShell TFM 4th Editionwhich is one of the few books on the market that covers PowerShell version 4. ](/images/2014/10/tfm4-640x480-1.jpgtfm4-640x480)I was one of the beta testers for PowerShell Studio 2014. Since I had early access to the product, it only made sense to write a chapter about that product in the new Windows PowerShell TFMbook.

How to check the PowerShell version & install a new version

In my last blog article I demonstrated “Where to Find & How to Launch PowerShell”. Today I’ll continue on to the next step which is determining what version of PowerShell you have installed. PowerShell version information is contained in the $PSVersionTable automatic variable. You can type out $PSVersionTable in the console window that you opened in the last blog article or you can type $psv and press tab to take advantage of what’s called tabbed expansion:

Where to Find & How to Launch PowerShell

Happy New Year! What better way to start the new year out than by setting some goals and what better goal to set than to learn PowerShell this year. Let’s start out at ground zero by learning how to launch PowerShell. On Windows 8 or 8.1, simply start typing the word PowerShell on the Metro interface screen: Maybe you’re still running Windows 7? If so, the shortcuts for PowerShell are located in the start menu under All Programs > Accessories > Windows PowerShell:

Mount an ISO on a Physical Server running Server Core

So you need to mount an ISO on a physical server that is running Windows Server 2012 R2 Server Core? If so, how would you accomplish that task without a graphical user interface? With PowerShell of course, specifically the Mount-DiskImage PowerShell cmdlet: Mount-DiskImage -ImagePath 'D:\ISO\Windows Server 2012 Trial\9200.16384.WIN8_RTM.120725-1247_X64FRE_SERVER_EVAL_EN-US-HRM_SSS_X64FREE_EN-US_DV5.ISO' -StorageType ISO -PassThru By default nothing is returned when using the Mount-DiskImage cmdlet and the ISO is mounted using the next available drive letter.

PowerShell One-Liner: Create a new Hyper-V VM

My test environment resides on a workstation that runs Windows 8.1 Enterprise Edition with the Hyper-V role enabled. I need to create a new VM that will be used as a second domain controller in my test environment. I’ll use a PowerShell one-liner to create this new VM which will use a differencing disk based on a Windows Server 2012 R2 vhdx that has been fully patched and syspreped: New-VM -Name 'DC02' -VHDPath ( New-VHD -Differencing -ParentPath 'D:\Hyper-V\Virtual Hard Disks\template\Server2012R2Core-Template.

Presenting for the Singapore PowerShell User Group PowerBreakfast 007: What’s New in PowerShell Version 5

I’ll be presenting a session on “What’s New in PowerShell Version 5” for the Singapore PowerShell User Group’s PowerBreakfast #007 this Saturday, December 13th beginning at 8:30am (Singapore time). Sign up on Eventbriteif you’re interested in attending this event. Here’s what you can expect from this presentation: With PowerShell version 4 being announced at TechEd last year (2013) and several preview versions of PowerShell version 5 already being released this year, it shows how committed Microsoft is to PowerShell and that it’s not going away any time soon which is why you can’t afford to ignore PowerShell or put off learning it any longer.

Use a certificate with PowerShell DSC to add a server to Active Directory without hard coding a password

A new Windows Server 2012 R2 machine has been brought online and needs to be joined to your Active Directory domain. All machines used in this demonstration are running either Windows Server 2012 R2 or Windows 8.1 with PowerShell version 4. You’ve decided to use DSC (Desired State Configuration) to join this new server to the domain because it’s a prototype for many more servers to come. You plan to automate their deployment along with the majority of their configuration with DSC.

Using PowerShell to add the necessary vWorkspace Firewall Exceptions on a Hyper-V Host Virtualization Server

Recently while adding a Windows Server 2012 R2 Hyper-V server as a host virtualization server in a vWorkspace 8.0.1 environment, I received the following error message: “Connect to DC service timed out. Overlapped I/O operation is in progress. (997) Retry will occur automatically if necessary."That error message lead me to a Dell support articlewhich stated that I needed to either disable the firewall <which is not going to happen on my watch> or open port 5203.

Use PowerShell to Install Active Directory Certificate Services

In this blog article, I’ll use PowerShell to install Active Directory Certificate Services in my test environment. The domain controller that’s being used is running Windows Server 2012 R2 Server Core Installation (no-GUI). The workstation that I’m using is running Windows 8.1 and it is a member of the same Active Directory domain. Many times when I’m prototyping something on a single remote server, I’ll use one to one remoting so that it’s an interactive session.

My New Book: Windows PowerShell TFM 4th Edition is now Available!

If you work with technology then I’m sure you’re already aware that PowerShell is one of those technologies that is quickly becoming a must have skill. Whether you’re a beginner or someone who is looking to become more proficient with PowerShell, there’s a new book on the market that is an all in one learning guide, lab guide, and PowerShell reference. I’m happy to say that I’m proud to be part of the Superhero team at SAPIEN Technologies who is bringing you the Windows PowerShell TFM 4th Edition book:

PowerShell: When Best Practices and Accurate Results Collide

I’m a big believer in trying to write my PowerShell code to what the industry considers to be the best practices as most are common sense anyway, although as one person once told me: “Common sense isn’t all that common anymore”. I would hope that even the most diehard best practices person would realize that if you run into a scenario where following best practices causes the results to be skewed, that at least in that scenario it’s worth taking a step back so you can see the bigger picture.

PowerShell Desired State Configuration Error: Undefined Property ConfigurationName

The scenario in this blog article is that you’ve created a DSC configuration on a computer that’s running a preview of PowerShell version 5. The machine itself could be running Windows 8.1, Server 2012 R2, or the Windows Technical Preview version of Windows 10. Here’s a simple configuration that I’ll use to demonstrate the problem. This DSC configuration uses a custom DSC resource to rename a computer. This configuration is being created on a machine running the Windows Technical Preview version of Windows 10 with PowerShell version 5 build 9860 (the most recent build as of this writing).

Use PowerShell to Determine the Uptime of an EqualLogic SAN

Recently, I received notification from EqualLogic support that there could be issues with their storage area networks running firmware version 7.0.x at 248 consecutive days of uninterrupted operation and they recommend updating to firmware version 7.0.9 to correct (and prevent) the problem. While I know that I have EqualLogic storage area networks running in some of the data-centers I support, I’m not sure what version of firmware they’re running or what the uptime on them is so I’ll use PowerShell (of course) to determine this information.

Use PowerShell to Determine the Differences in Group Membership between Active Directory Users

I recently saw a post on Reddit where someone was trying to create a function that takes an Active Directory user name as input for a manager who has direct reports (subordinates) specified in Active Directory. They wanted to determine if the Active Directory group membership of any of those subordinates is different than the others. There are two different parts to this scenario. Returning a list of the manager’s direct reports by querying that property from the manager’s user account in Active Directory:

Using Pester for Test Driven Development in PowerShell

How do you normally write your PowerShell code? Your answer is probably like mine and most other IT pros. You have a task that you need to accomplish and instead of performing a clicker-size in the GUI whenever that task is required to be performed, you write a PowerShell one-liner, script, or function to automate that task. You test it a little to make sure there aren’t any major issues and you implement it, moving on to the next task.

Creating a Custom DSC Resource to Configure Jumbo Frames on Network Cards

Recently while working on configuring a new server with DSC (Desired State Configuration), I discovered that there wasn’t a DSC resource for configuring the jumbo frames setting on network cards so I decided to write my own. This blog article steps you through the process of creating a custom DSC resource, specifically one that is used to configure the jumbo frames setting on network cards. The specific settings for jumbo frames can vary depending on your network card manufacturer and the specific driver.

My Solution to the Impractical One-liner Challenge

I recently participated in an Impractical One-liner Challenge that Stephen Owen posted on his blog site where he challenged his readers to come up with a PowerShell one-liner that would allow the person running it to select a single OU (Organizational Unit) from a list of all the OU’s in Active Directory and then move a list of computer accounts that are contained in a text file to that OU.

Use PowerShell to Determine what Outlook Client Versions are accessing your Exchange Servers

Earlier this month I saw a blog article on The EXPTA {blog} about Reporting Outlook Client Versions Using Log Parser Studio and I thought I would show you a simple alternative using PowerShell that accomplishes the same task while giving you some additional flexibility. This simple PowerShell function can be used to parse the Exchange Server RPC logs. #Requires -Version 3.0 function Get-MrRCAProtocolLog { <# .SYNOPSISIdentifies and reports which Outlook client versions are being used to access Exchange.

Unlock a Volume Protected with BitLocker Drive Encryption

Have a Windows Server 2012 R2 machine that runs the Server Core (no-GUI) installation of the operating system? Maybe that server has a volume that is protected with BitLocker Drive Encryption? If so, how would you unlock the encryption so you can access the data on that volume without using a graphical user interface? With PowerShell of course, specifically the Unlock-BitLockerPowerShell cmdlet: Unlock-BitLocker -MountPoint 'D:' -Password (Read-Host 'Enter Password' -AsSecureString) µ

Creating a Simplistic GUI Interface with Out-GridView

A couple of weeks ago I noticed a post in the forums at PowerShell.orgwhere a question was asked about selecting a group of servers in Server Manager and running a PowerShell script against that selection of machines. While my solution doesn’t accomplish exactly what I think they were looking for, it does the next best thing. First, I added a menu item to Server Manager called MrToolkit (short for Mike Robbins Toolkit) based on a “Customize Tools menu in Server Manager” blog article on the TechNet Server Manager Blog:

New Modules, Cmdlets, & Parameters in PowerShell Version 5

Think keeping up with the changes between major versions of PowerShell is difficult? Well just try keeping up with the changes that are added and removed in preview versions. The following is a list of the new modules, cmdlets, and parameters that have been added so far in PowerShell version 5 grouped by the different preview releases. Windows Technical Preview Enterprise Edition (Windows 10) PowerShell Version 5 Build 9879

PowerShell Function to Create CimSessions to Remote Computers with Fallback to Dcom

I’ve found myself writing the same code over and over in my PowerShell scripts where I’m performing a task that requires me to create a CimSession to one or more computers without knowing what version of PowerShell is installed on the remote computers or if PowerShell is even installed on the remote computers. While it is possible to create a CimSession to a remote computer in any of those scenarios I just described, it’s a fair amount of code to add to multiple scripts and then the same redundant code ends up being in multiple files which creates a nightmare if you ever find an issue with the code and need to update it for any reason.

PowerShell Track at SQL Saturday #328 in Birmingham Alabama this Weekend!

Do you work with technology and live within driving distance of Birmingham Alabama? Then you should consider attending SQL Saturday #328this weekend. There’s an entire track dedicated to PowerShell and while a few of the sessions in that particular track will focus on SQL Server, there’s also a session on PowerShell Fundamentals for SharePoint, a session on Stupid PowerShell Tricks by PowerShell MVP Jim Christopher, and a session on the new features in PowerShell version 5 that I’ll be presenting.

Don’t miss the boat: PowerShell Summit Europe 2014

If you’re a frequent reader of the articles on this blog site then you probably already know that the information I write about is based on my real world experiences and the same holds true for this blog article about the PowerShell Summit conferences. During the past two years (since its inception), I have attended the PowerShell Summit North America and I can say without doubt that attending those conferences has definitely helped to advance my career.

Set a Users Active Directory Display Name with PowerShell

I recently saw an article on how to set a users Active Directory display name based on the values of their given name, initials, and surname. I came up with my own unique solution for this task and thought I would share it with you, the readers of my blog. As you can see in the following example, there are a mixture of users who need their display name corrected based on the requirement that their display name be listed as “Givenname Initials Surname”:

Exclude Delayed Start Services when Checking Status with PowerShell

While using PowerShell to return a list of Windows services that are set to startup automatically and aren’t running may sound like a simple task, it’s not quite as easy as it sounds, at least not if you want accurate results. This is due to the services that are set to startup automatically with a delayed start skewing the results. For more information on how to accurately return a list of services that should be running, but aren’t based on services that have a startup type of automatic while excluding the ones that are set to start automatically with a delayed start, see my article that is featured on the Hey, Scripting Guy!

Using PowerShell to discover information about your Microsoft SQL Servers

Earlier this week, I had an article published by PowerShell Magazine on the subject of “Using PowerShell to discover information about your Microsoft SQL Servers”. Here’s a brief description about that article: “In this article, I’ll be discussing how PowerShell can be used to retrieve just about any information that you would want to know about modern versions of SQL Server that you currently have running in your environment. This article isn’t meant to be a deep dive, it’s meant to get you started thinking about how you could write your own PowerShell code to retrieve the specific information that you’re looking for from your SQL Servers.

Find and Disable Active Directory Users with PowerShell Faster than You can Open the GUI

In this scenario, a support request has been escalated to you because the help desk is unable to find a user account in Active Directory that needs to be disabled. The help desk included a screenshot where they attempted to search for the user who is named “William Doe”: The request you received also stated that the user is in the “Sales” department so you perform a quick search for users who have a last name of “Doe” and who are also in the “Sales” department:

Extract the Name from an Active Directory Distinguished Name with PowerShell and a Regular Expression

This is actually something I had a small blurb about in my previous blog article, but I wanted to go back, revisit it, and write a dedicated blog article about it. Sometimes there are properties in Active Directory like the one in the following example where the “Manager” property is being returned as a distinguished name and what you really wanted was just their name (in human readable format): Get-ADUser -Filter * -SearchBase 'OU=Northwind Users,OU=Users,OU=Test,DC=mikefrobbins,DC=com' -Properties Manager, Title | Format-Table -Property Name, Title, Manager -AutoSize You could write a complicated function or script to query Active Directory for the “Managers” information and create a custom object to return both the actual users information and the managers information, but if you simply want the name of the manager (in this example), it’s much easier to use the substring method or a regular expression.

From Dangerous Script Copy & Paster to Scripting Games Winner and now PowerShell MVP!

I’ve been working in Information Technology for 20 years this year and I’ve wasted more than half of my career in the GUI (Graphical User Interface) having to learn GUI’s for numerous products and different versions of all those different products over the years, more products and versions than I can count. Back in th](/images/2014/07/wiiu-mvp.jpgwiiu-mvp)e VBScript days, I was the dangerous script copy and paster. Then when Exchange Server 2007 shipped, I was forced to learn at least some PowerShell since there were many things that couldn’t be accomplished in the GUI, especially prior to SP1, but I was still somewhat of a dangerous script copy and paster.

Create Active Directory Users Home Folder and Assign Permissions with PowerShell

The following function is a work in progress, but I thought I would go ahead and share it. This function requires a module named PowerShellAccessControl that was created by Rohn Edwards which is downloadable from the TechNet Script Repository. The version 3.0 beta revision of his module which is also downloadable on that same page is what was used to test the examples shown in this blog article. #Requires -Version 3.

Using PowerShell to Search for Specific Users in Active Directory without Knowing their Exact Information

You’re looking for a user in your Active Directory environment who goes by the nickname of “JW”. You know that’s the user’s initials and you need to find their AD user account. Typically you’d use the Identity parameter, but that parameter doesn’t allow wildcards: Get-ADUser -Identity j*w* Verifying wildcard’s are not allowed on the Identity parameter of Get-ADUser: help Get-ADUser -Parameter identity What you’ll need to do is use the Filter parameter instead:

PowerShell Function to Prevent Starting Hyper-V VM’s that are Connected to an External Network

Beginning with Windows 8 (Professional and Enterprise Edition), Hyper-V is available on workstations that have a processor that supports SLAT (Second Level Address Translation). For specifics about the requirements, see the Client Hyper-V blog article on Microsoft TechNet. That means you have a Hypervisor running right on your desktop or laptop computer for free. With the price of hardware these days, your regular everyday computer can be spec’d out with an i7 processor, 16 gigabytes of memory, and one or more solid state drives and in addition to performing your everyday work on it, you have an awesome test environment without the need for additional physical computers.

Determine the Last Day of the Previous Month with PowerShell

I recently had a need to determine the last day of the previous month with PowerShell. Unless I’m overlooking something, PowerShell doesn’t natively have a way to determine this. Luckily, the System.Time class in the .NET Framework has a DaysInMonth method that returns the number of days in a specific month which effectively gives you the last day of the month. The command to determine what I needed was simple enough:

PowerShell Version 5 New Feature: New Parameters added to the New-DscCheckSum and Test-DscConfiguration Cmdlets

I’m continuing on my series of blog articles on the new features in the preview version of PowerShell version 5. Today I’ll be discussing the existing DSC (Desired State Configuration) cmdlets in PowerShell version 4 that now have new parameters as of the May 2014 preview version of PowerShell version 5. To begin, I’ll define a DSC configuration that’s parameterized so that it’s reusable: configuration iSCSI { param ( [Parameter(Mandatory)] [string[]]$ComputerName ) node $ComputerName { WindowsFeature MultipathIO { Name = 'Multipath-IO' Ensure = 'Present' } Service iSCSIService { Name = 'MSiSCSI' StartupType = 'Automatic' State = 'Running' } } } Run the configuration specifying the computer names to create MOF files for:

PowerShell Version 5 New Feature: SkipLast Parameter added to Select-Object

I’m picking up where I left off in my last blog articleon the new features in the PowerShell version 5 preview. Today I be covering a new parameter, SkipLast that has been added to the Select-Object cmdlet. I have a text file where I saved a list of the available packages in the default OneGet Chocolatey repository. There are a total of 1893 items in this file: (Get-Content -Path C:\demo\packages.txt).count I’ll use the new SkipLast parameter to skip the last 1885 items:

If (‘Interested’ -in ‘PowerShell’) {‘Are you Participating in the PowerShell.org Forums?’}

If you’re interested in PowerShell and you’re not participating in the forums at PowerShell.org, you’re missing out on an awesome opportunity to learn from others instead of having to re-invent the wheel each time you need to accomplish a task. If you’ve been using PowerShell for a while and you’re not participating in the forums, then you’re missing out on an opportunity to help others who are asking for your assistance.

Error when Using PowerShellGet Find-Module or Install-Module with the Name Parameter and a Local NuGet Repository

If you’re following me on Twitterthen you probably know that I’ve been working a lot with the new features in PowerShell version 5, with my focus being on the cmdlets in the OneGet and PowerShellGet modules. I’ve been fighting an issue where an error is received when the Name parameter is specified with Find-Module or Install-Module when using a local NuGet Repository: Find-PSGetExtModule : Module ‘Pscx’ was not found in the Gallery.

Helping Others at Microsoft TechEd with PowerShell 911

While at Microsoft TechEd last week, I met a gentleman from Europe who was experiencing a particular issue with the Get-ADUser PowerShell cmdlet. When Get-ADUser is used with a hard coded value such as name as shown in the following example, it returns the expected information without issue: Get-ADUser -Filter {Name -eq 'Administrator'} The issue is that when the name, for example, is stored in a variable and double quotes are used to try to expand the variable, nothing is returned:

Open Scripts in a new tab in the PowerShell ISE using PSEdit

While at TechEd last week, PSEdit was used in one of the PowerShell sessions that I sat through. Afterwards a couple of friends asked me if I had ever heard of it and said they hadn’t so I thought I would write a blog article about it to help spread the word. PSEdit is a function that only exists in the PowerShell ISE. Type in PSEdit followed by the name of a PowerShell script and that script will be opened in a new tab in the ISE:

How to Create Reusable PowerShell Functions for Microsoft SQL Server Database Administration

In my last blog article on Getting Started with Administering and Managing Microsoft SQL Server with PowerShell, I left off by introducing you to how to query information about your SQL Server using PowerShell with SQL Server Management Objects (SMO). In this blog article, I’ll pick up where I left off and write a reusable PowerShell function to return information about SQL Server files and file groups while making the use of SMO transparent to the user of the function.

You Know You’re a PowerShell Evangelist when Vendors you don’t even Work for Refer People to You

Have a conversation with me and two subjects will almost always come up. One is PowerShell and the other is Server Core installation (no GUI) on Windows Servers. People even make fun of me because of it. Call me a nerd and I’ll reply: “and proud of it”. What comes around goes around. I recently had a technology vendor that my employer hired for some assistance start referring people back to me who were interested in PowerShell.

I’m Speaking on the New Features in PowerShell version 5 (Preview) at ATL TechStravaganza 2014

I’ve been home for a couple of hours now from the PowerShell Summit North America 2014which was in the Seattle Washington area earlier this week and my brain is about to explode from all of the PowerShell awesomeness that I learned about. There will be many blog articles to follow on those subjects, but I wanted to let my readers know that I’ll be speaking at the ATL TechStravaganza 2014in Atlanta Georgia on Friday, June 6th.

Getting Started with Administering and Managing Microsoft SQL Server with PowerShell

I’ve used PowerShell to administer and manage Microsoft SQL Server for quite some time although I haven’t blogged much about it. I thought I would take the time to write a series of blog articles about using PowerShell to administer and manage Microsoft SQL Server to help others who are just getting started and to clear up some common misconceptions. Just to give you a little background information about myself, I’ve worked (professionally) in a data-center environment administering and managing every version of SQL Server since 6.

Checking and Setting the Start Mode of a Windows Service with PowerShell

Working with Services in PowerShell is probably one of the first tasks you’ll undertake as a PowerShell newbie. Recently I needed to disable a few Windows services on a server and I’m a big believer in being able to get back to where you started so the first thing I set out to accomplish was to find out what the start mode was of the services I needed to change.

Exploring the Find-Package Cmdlet from the PowerShell version 5 Preview OneGet Module

While presenting on the OneGet Module in the preview version of PowerShell version 5 for the Mississippi PowerShell User Grouplast week I discovered a couple of things about the Find-Package cmdlet that I wanted to share. The first thing is wildcards don’t work with the name parameter: Find-Package -Name *Java* That’s seems to be because they’re already performing a wildcard search as I’ll search for ‘Java’ in the following example and notice that none of the packages are that exact name.

One Month Until Microsoft TechEd North America 2014!

I’ve attended Microsoft TechEd North Americaevery year consecutively for the past four years and this year will make five years in a row that I’ve attended. If there’s a specific technology you’re interested in, there are precons on the Sunday prior ](/images/2014/02/teched-2014-im-going.jpg)to TechEd for an additional fee that are a really good value. I’ve attended Exchange, SharePoint, and SQL Server precons at TechEd in the past. Todd Klindtwho is a SharePoint MVP is doing a SharePoint precon again this year.

Return an Error Message from a Remote Computer when an Attempt to Install a Package using the OneGet Module Fails

This blog article will walk you through the issue of the OneGet module not returning an error message when an attempt to install a package fails on a remote computer via the Install-Package cmdlet and PowerShell remoting. Attempting to install a package such as WireShark on a remote computer gives you a quick flash across the screen that’s too quick to read and then it gives your prompt back with no errors and no feedback about whether or not the package was installed:

Getting Installed Packages InSync Across Multiple Machines with the PowerShell version 5 Preview OneGet Module

I presented a session for the Mississippi PowerShell User Groupa couple of days ago and I thought I would share a couple of things I showed during that presentation that I hadn’t previously blogged about. I’m starting where I left off during my last blog article about the OneGet modulein the PowerShell version 5 preview. I’ve stored the names of the packages that are installed on the local computer (PC03) in a variable named Software and created PSSessions to three remote computers (PC04, PC05, and PC06).

Less than one week left before Registration closes for the PowerShell Summit North America 2014!

I attended the PowerShell Summit North America 2013 last year so I speak from experience when I say that the PowerShell Summit North America 2014 is a conference that you don’t want to miss and it’s the best value that you’ll find in a PowerShell related conference this year . ](/images/2014/04/Summit-Horiz-Logo-Color.png)Last year the Summit was smaller with a very limited number of tickets available which sold out well before the end of 2012 and there were a lot of people who missed out.

Using the PowerShell version 5 Preview OneGet Module with PowerShell Remoting

I’m picking up where I left off in my last blog article. Adobe Reader, ImgBurn, and WinRAR have been installed on a Windows 8.1 Enterprise edition computer named PC03. All of the examples shown in this blog article are being run from the PC03 computer. I’ll use a little trick I showed you a few blog articles ago and store the names of the installed packages in a variable and return them at the same time, all in a one-liner:

Installing Software with the OneGet Module in PowerShell version 5

As referenced in my previous blog article, a preview version of PowerShell version 5 was released last week. One of the new modules is named “OneGet” which contains a number of new PowerShell cmdlets: Get-Command -Module OneGet There’s only limited help available for these cmdlets since attempting to update the help fails for the two new modules that are part of the PowerShell version 5 preview: Update-Help Update-Help : Failed to update Help for the module(s) ‘NetworkSwitch, OneGet’ with UI culture(s) {en-US} : For security reasons DTD is prohibited in this XML document.

How to Install the Preview Version of PowerShell Version 5

The Windows Management Framework v5 Previewwas announced and released a few days ago (on April 3, 2014) which includes a preview version of PowerShell version 5. Be sure to read through the System Requirements on the actual download pagebefore attempting to install this preview version because it’s not recommended to be installed at this time on systems with certain software installed such as Exchange Server 2007. I didn’t see this stated on the download page and I think it goes without saying, but I wouldn’t recommend installing this preview version in a production environment.

Where and Foreach Methods in PowerShell version 4

It’s a little over a month until Microsoft TechEd North America 2014which is in Houston this year. I was trying to remember the cool stuff I saw at TechEd last year and Desired State Configuration along with the announcement about PowerShell version 4 were the two big things I remember, but let’s not forget about some of the other things such as the new Where and Foreach methods. I certainly don’t claim to be an expert with these, but I’m going to provide a couple of examples for documentation for myself as well as to get you thinking about them:

PowerShell: Output the Result of a Command and Assign it to a Variable in One Line

As of today, there is one month left until the PowerShell Summit North America 2014. I tweeted something out last night and thought I would write a quick blog about it since I often find myself looking for a tweet months later when I can’t remember how I did something that I previously tweeted out. This tweet used all 140 characters that twitter allows: "There are $(($i=New-TimeSpan -End 2014-04-28T09:00-07).Days)days & $($i.

Run a local PowerShell Function against a Remote Computer with PowerShell Remoting

Did you know that it’s super easy to run a function that exists only on your local computer against a remote computer even when no remoting capabilities have been added to the function itself? It does however require that PowerShell remoting be enabled on the remote system, but if you’re running Windows Server 2012 or higher, PowerShell remoting is enabled by default on those operating systems. I’ll start off by creating a function that performs a meaningful task so I can use it to demonstrate this process.

Use PowerShell to Determine the PDC Emulator FSMO Role Holder in your Active Directory Forest Root Domain

Each domain has a PDC emulator FSMO role so how do I determine which domain controller holds the PDC emulator FSMO role in the forest root domain if I have multiple domains in my forest? Sounds like you can’t see the forest root for the trees :-). The answer of course is with PowerShell: Get-ADForest | Select-Object -ExpandProperty RootDomain | Get-ADDomain | Select-Object -Property PDCEmulator The Active Directory PowerShell module which is part of the Remote Server Administration Tools (RSAT) is installed on the workstation these commands are being run from.

Proving Leap Year is NOT Every Four Years with PowerShell

Last week, I saw a couple of tweets from PowerShell MVP Jeffery Hicks about leap year that caught my attention: ](/images/2014/03/030614-1.png)One of the reasons that I found those tweets so interesting is that I had just heard the night before on of all places, Wheel of Fortune, that leap year wasn’t every four years. I’d always been told that leap year was every four years and it has been for my entire life so it was time to investigate further.

Two Months Until the PowerShell Summit North America 2014

There are only two months left until the PowerShell Summit North America 2014. The tickets for the 2013 PowerShell Summit sold out before the end of 2012 and a lot of people missed out on an awesome opportunity because they didn’t act quickly enough. Well, this year they’ve expanded the capacity by moving it to a different location in Seattle and the tickets were sold in stages. So what are you waiting for?

No PowerShell, you may not install Bing Desktop on my Computer!

I recently noticed some strange behavior from PowerShell on my computer when attempting to import all of the available modules : Get-Module -ListAvailable | Import-Module -DisableNameChecking PS [MikeFRobbins.com]>Import-Module -Name PSWindowsUpdate ConfirmAre you sure you want to perform this action?Performing the operation “Bing Desktop v1.3.1[9 MB]?” on target “PC01”.[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is “Y”):I could create some elaborate script to iterate through each module and tell me what module is trying to install Bing Desktop, or I can simply use the -PassThru parameter:

PowerShell One-Liner to List All Modules and Return How Many Cmdlets Each One Contains

A big misconception when it comes to PowerShell one-liners is that they’re one line of code as the name implies. That assumption is incorrect though because a one-liner can be written in one physical line of code such as in this example: Get-Module -ListAvailable | Import-Module -PassThru | ForEach-Object {Get-Command -Module $_} | Group-Object -Property ModuleName -NoElement | Sort-Object -Property Count -Descending Or it can be written in multiple physical lines of code such as in the next example.

Using PowerShell to Investigate Duplicate IP Address Issues that were issued from a Microsoft based DHCP Server

Over the past couple of weeks, you’ve received several support calls about duplicate IP Address issues from users whose machines receive their IP Address from your organizations internal Microsoft based DHCP Servers. The users who reported the issues use thin clients and when the IP Address conflicts occur they receive a popup message containing their IP Address and the MAC Address of the machine that duplicated the IP Address. You and your staff need to retrieve additional information about the IP Address and MAC Address that the users received in order to try to determine what’s causing the problem.

Add an Active Directory User to the Same Groups as Another User with PowerShell

A request has been received to grant additional permissions to an existing user in your organizations Active Directory environment. The username of this existing user is “frank0”. In additional to his current responsibilities, Frank will be taking on the responsibilities of Alan who goes by the username of “alan0”. Note: The examples shown in this blog article are being performed on a Windows 8.1 machine that has the remote server administration toolsinstalled.

PowerShell Tip from the Head Coach of the 2014 Winter Scripting Games: Design for Performance and Efficiency!

There are several concepts that come to mind when discussing the topic of designing your PowerShell commands for performance and efficiency, but in my opinion one of the items at the top of the list is “Filtering Left” which is what I’ll be covering in this blog article. First, let’s start out by taking a look at an example of a simple one-liner command that’s poorly written from a performance and efficiency standpoint:

PowerShell Tip #3 from the Winner of the Advanced Category in the 2013 Scripting Games

In my previous blog article (PowerShell Tip #2), I left off with the subject of inline help and stated there was a better way. I’m fast-forwarding through lots of concepts and jumping right into “Advanced Functions and Scripts” with this tip because they are where you’ll find the answer to a “better way” to add inline help. The inline comments we saw in the previous tip looked like this: function Get-BiosInfo { # Attempting to retrieve the BIOS information from the local computer Get-WmiObject -Class Win32_BIOS } When looking at the syntax for this function, you can see that it has no parameters:

PowerShell Tip #2 from the Winner of the Advanced Category in the 2013 Scripting Games

Tip #2 - Comment (Document) your code! This is another one of those tips that probably isn’t very popular, but regardless of how good you are at writing PowerShell scripts and functions, they’re useless if no one else can figure out how to use them. You might be thinking that you’re the only one who uses the PowerShell code that you write, but I’m sure that you like to go on vacation just like the rest of us and none of us are going to live forever.

PowerShell Tip #1 from the Winner of the Advanced Category in the 2013 Scripting Games

In case you haven’t heard, the 2014 Winter Scripting Games are just now getting started. Regardless of your skill level with PowerShell, it couldn’t be a better time to participate since this is the first time in the history of the scripting games that you’ll be able to work as part of a team and receive proactive feedback (before your code is judged) from a team of expert coaches who use PowerShell in the real world on a daily basis.

Introducing the Coaches of the 2014 Winter Scripting Games

A few weeks ago, just before the announcement to start recruiting your team for the 2014 Winter Scripting Games, I was contacted by Don Jones and Richard Siddaway about an opportunity to become the Head Coach for the Winter Scripting Games. I was honored to have been contacted and I’m a firm believer of taking advantage of opportunities when they emerge, especially when they’re PowerShell related, so I graciously accepted.

Using PowerShell to Remove Phishing Emails from User Mailboxes on an Exchange Server

You’ve all seen those phishing emails that occasionally get past your spam filters and you all also know that no matter how many times you tell users not to open those suspicious emails and click on links contained in them, users are ultimately gullible so sometimes you have to take matters into your own hands and protect them from themselves. Here’s an example of a recent phishing email that I’ve seen:

Setting an Active Directory User Account to Expire at a Specific Time of Day with PowerShell

Notice that in Active Directory Users and Computers (ADUC) when setting the expiration of a user account, there’s only a way to have the account expire at the end of a specific day: The same option exists in the Active Directory Administrative Center (ADAC): In ADAC, you can see the PowerShell command that the GUI uses to accomplish this task: Let’s query that particular property with PowerShell to see exactly what it’s now set to:

PowerShell Remoting Error When Trying to use Invoke-Command Against a Domain Controller

I wrote a blog article last year titled “Welcome to PowerShell Hell” where the Antivirus I was using on my workstation had caused issues when trying to connect to remote machines with PowerShell. I recently reloaded my workstation with Windows 8.1 and reloaded the Antivirus which is now at version 7 (Eset NOD32). Remote connectivity via PowerShell worked without issue and without having to change any settings except when trying to use the Invoke-Command cmdlet against domain controllers which I find to be very strange.

Take an EqualLogic PS Series SAN Volume Offline or Bring it Online with PowerShell

You have a volume on your EqualLogic PS Series SAN named “mikefrobbins”: The EqualLogic Host Integration Tool (HIT) Kit for Microsoft which can be downloaded from support.equallogic.comis required to complete the steps shown in this blog article. The following PowerShell script can be used to take this particular SAN volume offline: $GrpAddr = "10.0.0.200" $VolName = "mikefrobbins" Import-Module "c:\program files\EqualLogic\bin\EqlPSTools.dll" Connect-EqlGroup -GroupAddress $GrpAddr -Credential (Get-Credential) Set-EqlVolume -VolumeName $VolName -OnlineStatus offline Disconnect-EqlGroup -GroupAddress $GrpAddr The volume is now offline: Use the same script except with the –online parameter to bring the volume online:

PowerShell Script to Determine What Device is Locking Out an Active Directory User Account

I recently received a request to determine why a specific user account was constantly being locked out after changing their Active Directory password and while I’ve previously written scripts to accomplish this same type of task, I decided to write an updated script. Active Directory user account lockouts are replicated to the PDC emulator in the domain through emergency replication and while I could have used the Get-ADDomain cmdlet to easily determine the PDC emulator for the domain:

Lock Out Active Directory User Accounts with PowerShell

As I’m sure you’re aware, there’s no setting where you can simply flip a switch to lock out Active Directory user accounts. So what is one to do if you need some locked out accounts to do testing with? This script is something I whipped up to accomplish just that because I’m working on another blog where I need some locked out Active Directory user accounts to work with. This script requires the RSAT tools to be installed on the workstation that it is being run from, specifically the Active Directory and Group Policy modules.

PowerShell One-Liner to Locate Scripts and Automatically Open them in New Tabs in the ISE

I recently wrote a blog about how to find scripts where you had accomplished some specific task. That blog article was titled “How do I find that PowerShell Script where I did __________?” What if you not only want to find those scripts, but also open them automatically in new tabs in the PowerShell ISE? It just so happens that you’re in luck: Get-ChildItem -Path 'C:\Scripts\*.ps1' -Recurse | Select-String -Pattern "1.

Use PowerShell to Resolve the Error: “Not Enough Server Storage is Available to Process this Command”

Recently after updating the antivirus solution at one of my customer sites they started receiving the following error when attempting to access their old Windows 2003 servers: "\Server\Share is not accessible. You might not have permission to use this network resource. Contact the administrator of this server to find out if you have access permissions. Not enough server storage is available to process this command." The solution was to increase the IRPStackSize on the remote server as referenced in this Microsoft Support article.

Insane PowerShell One-Liner to Return the Name of Users with Quarantined Mailboxes in Exchange 2010

Have you ever had any mailboxes on your Exchange 2010 server marked as being quarantined? According to this TechNet article, Exchange will isolate or quarantine any mailboxes that it detects as being poisoned. That TechNet article goes on to tell you how you can drill down in the registry on the Exchange Server to locate the GUID of the quarantined mailboxes. I don’t know about you but using the GUI to dig around in the registry is not what I call fun so I decided to use PowerShell to accomplish that task.

How do I find that PowerShell Script where I did __________?

I saw a tweet from June Blendera few days ago that I thought was interesting: ](/images/2013/11/search-childitem1.png)I knew you could use Select-String for searching documents like this but it’s not something that I knew the exact syntax for off the top of my head. It’s something that would have taken me at least a few minutes to figure out, probably with a little trial and error. It just so happens that a few days later, I was looking for how I had done something with the range operator in one of my PowerShell scripts.


Windows 8.1 RSAT PowerShell Cmdlets Get-ADUser & Get-ADComputer : One or more Properties are Invalid

I saw a tweet yesterday from Chris Duckabout a PowerShell version 4.0 bug: ](/images/2013/11/aduser-bug1a.pngaduser-bug1a)Here’s a linkto the Connect Bug on this particular issue. The issue occurs when you try to use the Get-ADUser or _Get-ADCompute_r cmdlets along with specifying the Properties parameter with the asterisk “*” wildcard character to select all of the properties. No issue when the client is running Windows 8.1 with the RSAT toolsinstalled and the Active Directory domain controllers are running Windows Server 2012 R2:

Windows PowerShell 4.0 TFM Book by SAPIEN Press

The Windows PowerShell 4.0 TFM book by SAPIEN Press which I’m co-authoring along with PowerShell MVP Jason Helmickwas announced this week: For more information about the book, visit the SAPIEN blog article “Announcing PowerShell 4.0 TFM”. µ

PowerShell Saturday 005 Atlanta is this Saturday, October 26th

Don’t miss out on an awesome opportunity to attend a PowerShell Saturday technology event this weekend in Atlanta where you’ll be able to learn some PowerShell from Microsoft MVP’s, PowerShell enthusiasts, and product evangelists as well as being able to meet face to face and network with other IT pro’s in the industry! ](/images/2013/10/PowerShell-Saturday-Logo1.png)I’m scheduled to present two sessions, one on “PowerShell Best Practices and Lessons Learned from the 2013 Scripting Games”, and another on “GUI Toolmaking with PowerShell”.

PowerShell Function to Determine Daylight Saving Time

About a year ago, I wrote a PowerShell one-liner to “Calculate What Date Thanksgiving is on with PowerShell” (in the United States). When looking back at that blog now, my first thought is boy that is some rough code that’s hard to read. Instead of re-writing the same thing again, I decided to write something similar applying what I’ve learned during the past year to it. That’s how I came up with the idea to write a PowerShell function that returns the beginning and ending dates for daylight saving time in the USA for a given year or years:

PowerShell Saturday 006: Hear the Scripting Guy and the Winner of the Advanced Category in the Scripting Games

How would you like to attend a couple of awesome sessions of a PowerShell Saturday technology event without having to leave the comfort of your home? and without having to burn daylight or travel anywhere? and yes, we’re talking about live, not recorded sessions. You’re in luck, the first two sessions of PowerShell Saturday 006 in Singapore are going to be available to attend via a Lync online (virtual) meeting. Wait, it gets better.

Using PowerShell Desired State Configuration to Unzip Files

A couple of months ago I wrote a blog about a “PowerShell Function to Unzip Files Using the .NET Framework 4.5 with Fallback to COM”. I’ve since discovered that the new Desired State Configuration (DSC) feature in PowerShell version 4 can unzip files. You probably wouldn’t use this feature just to unzip a single file to a single server, but it does open up some interesting possibilities. This blog article is not meant to be an all inclusive tutorial on DSC, it’s only meant to give you a peek inside the built-in DSC Archive Resource capabilities.

PowerShell Oktoberfest: PowerShell Saturday 005 in Atlanta and 006 in Singapore

October is my favorite time of the year. The weather is cooler, the tree leaves are changing colors, and while I haven’t been to a real Oktoberfest in Germany in over twenty years, the coming month is filled with PowerShell related activities which will have to suffice. October 3rd - Philadelphia PowerShell User Groupmeeting. This is a physical meeting, but they have made their meetings available via Microsoft Lync as well.

Fun and Games with PowerShell

My daughter has been learning Python which I know nothing about (I’m not a developer). I took a look at one of the programs that she’s been working on and said I don’t know Python, but I can create something better than that in PowerShell. I hadn’t previously used a “do until” loop in PowerShell so I decided this was as good as an excuse as any to use one since the loop has to run at least once anyway and it gave me a chance to learn something new.

PhillyPosh User Group Meeting Presentation Follow-up: PowerShell Second-Hop Problem with CimSessions

This blog article is a follow-up to my presentation for the Philadelphia PowerShell User Group which was on September 5th. A video of that presentation is available on the PhillyPosh YouTube Channel: I received a question towards the end of the meeting wanting to know if the Cim Cmdlets and Sessions experience the same sort of second hop authentication issue as using Invoke-Command where your credentials can’t be re-used by a remote machine for authentication to access resources on a third machine that your command is attempting to use.

Speaking on Using CIM Cmdlets and CIM Sessions for the Philadelphia PowerShell User Group Tonight!

Years ago, needing something as simple as the serial number from a remote server often meant that administrators had to resort to making a trip to the remote location. Even back in those days, some administrators were savvy enough to query WMI with third party programs or scripting languages such as VBScript to retrieve this information. Although, querying WMI was kind of like black magic back in those days and it was often simply easier to travel to the remote site or spend the money to purchase a third party product that could make retrieving this type of information easier for an average administrator.

PowerShell Function to Stop a Windows Service with a Status of Stopping

If you’re reading this blog article, you’ve probably tried to stop a Windows Service and it’s hung or stuck with a status of “Stopping”: An average Windows Admin would say “The server is going to have to be rebooted to clear up this problem”. This problem can be resolved with PowerShell though without the need for a restart. The machine I’m testing these examples on just happens to be running PowerShell version 2 so I’ll use the v2 syntax to see if the Get-Service cmdlet has any properties that may help.

PowerShell Function to Unzip Files Using the .NET Framework 4.5 with Fallback to COM

A few days ago, I saw a tweet about someone needing to extract a zip file with PowerShell and wanting to accomplish the task without loading any third party extensions so I thought I would write a function to accomplish the task. I start out by declaring the function followed by its name, it includes comment based help which is collapsed in the following image, then the [CmdletBinding()] attribute is specified to define this function as an advanced function.

PowerShell Parameter Validation: Building a Better ValidatePattern with ValidateScript

Let’s start out by taking a look at what the PowerShell built-in help says about the ValidatePattern and ValidateScript validation attributes: ](/images/2013/08/about-fap2.pngabout-fap2)Here’s what that help topic says about ValidatePattern: We’ll test using ValidatePattern with an example that I used in my entry for advanced event #4 in the Script Games this year as shown in the following example: function Test-ValidatePattern { [CmdletBinding()] param( [Parameter(Mandatory)] [ValidatePattern("^(?!^(PRN|AUX|CLOCK\$|NUL|CON|COM\d|LPT\d|\..*)(\..+)?$)[^\x00-\x1f\\?*:\"";|/]+\.html?$")] [string]$FileName ) Write-Output $FileName } Who knows what that regular expression does?

What does PowerShell, SQL Server, Swag, and Jambalaya all have in common?

What does PowerShell, SQL Server, Swag, and Jambalaya all have in common? SQL Saturday #234 in Baton Rougethis Saturday, August 3rd. Whether you want to learn some PowerShell or SQL, a chance to win some cool swag, network with other technology enthusiasts in the industry, or maybe you just want a free jambalaya lunch, then the place to be this Saturday, August 3rd is SQL Saturday #234 in Baton Rouge, Louisiana.

Buy a PowerShell Conference in a Book and Support Save the Children Charity in the Process

Maybe money’s tight this year and you’re unable to attend a conference or maybe you’ve already gone through your training budget for the year. There’s another way to attend that conference this year for little cost and what better technology than PowerShell to attend a conference on, all while supporting a great cause (Save the Children). book is designed to be like “A conference in a book” and contains 28 chapters divided up into four different sections (PowerShell Administration, PowerShell Scripting, PowerShell for Developers, and PowerShell Platforms).

Use PowerShell to Determine the Chain of VHD’s for a Virtual Machine on Hyper-V

You want to determine what VHD’s exist for the virtual machines (VM’s) that are virtualized on your Windows 8 or Windows Server 2012 Hyper-V virtualization host. This may sound simple, but what if you have a base image or template that has been configured and then multiple VM’s have been created using differencing disks that reference that single base image? If that weren’t difficult enough to keep track of, you may also have snapshots of those VM’s which are also classified as differencing disks in HyperV.

Want to Hear the Winner of the Advanced Category in the 2013 Scripting Games Speak?

Here’s where you can hear me speak over the next few months: July 2013 Thursday, July 11th (Tonight), at 9:30pm Eastern Time (8:30pm Central Time) PowerScripting Podcast Guest (Winner of the 2013 Scripting Games Advanced Category) August 2013 Saturday, August 3rd SQL Saturday #234 in Baton Rouge PowerShell Fundamentals for Beginners (Speaker) Show up early as there were 60 attendees in the 48 seat room that I was assigned the last time I presented this session in person (at SQL Saturday #220 in Atlanta).

How to Create PowerShell Script Modules and Module Manifests

My entry for the Scripting Games advanced event 4 contained four separate functions: I want to create a module that contains these functions. There are several different types of modules, but what I’ll be creating is a “Script Module”. Modules sound like something really complicated, but script modules are actually simple. Currently, I have the functions saved as a ps1 file which I dot-source to load the functions into memory, but I want to share this tool with others so it makes more sense to create a module out of it.

PowerShell Version 4 New Feature: A UserName Property Has Been Added To Get-Process Output Objects

Thanks to a tweet from Mark Schill, I discovered that Get-Process now has an “IncludeUserName” parameter in PowerShell version 4: This means no more having to use WMI to determine what processes are being run by which users: For those of us who work in a terminal services environment, this is a really big deal. I do find it odd that it was added via a switch parameter instead of just making it another property.

PowerShell Version 4 New Feature: Requires Statements Now Let Users Require Administrator Access Rights If Needed

In PowerShell version 4, there’s a new “-RunAsAdministrator” option for the #Requires statement that prevents a script from executing unless PowerShell is running as an administrator. The information about this new option from the PowerShell version 4 “about_Requires” help topic is shown in the following image. To learn more about the requires statement, run “help about_requires” from within PowerShell. Here’s the message that’s displayed if this option is specified and the person running the script is not an administrator:

Using a Counter Variable in a PowerShell Workflow Foreach -Parallel Loop

As I’m sure most of my blog readers are aware, I competed in the advanced track of the Scripting Games this year and ended up doing quite well. Two first place finishes and three second places finishes with the official judges and four first place crowd score finishes. I also ended up being the overall winner of the advanced track. A few days ago someone on twitter asked me as the winner of the Scripting Games advanced track, what I would do with it?

Win a Six Month Subscription to Interface Technical Training’s Video Collection by Solving this PowerShell Puzzle!

During the 2013 Scripting Games, I won three subscriptions, each good for six months of video training at Interface Technical Training. I have a subscription already so I asked Don Jones about re-gifting my prizes since I don’t need more than one subscription so here’s your chance to win one. The first video training subscription that I won was given to Rohn Edwards who is the co-founder of the Mississippi PowerShell User Group.

Exclusive PowerShell in a Month of Lunches Special Lunchbox Bundle Giveaway

The June meeting of the Mississippi PowerShell User Group is tomorrow night, June 11th at 8:30pm Central Time. This is a virtual (online) meeting so anyone from anywhere can join in! Our guest speaker for this month is well known author, speaker, and PowerShell MVP Jeffery Hicks. While at the PowerShell Summit back in April, Jeffery donated a limited edition PowerShell in a Month of Lunches bundle to include a special limited edition lunchbox, Learn Windows PowerShell 3 in a Month of Lunches Second Edition book, and Learn PowerShell Toolmaking in a Month of Lunches book as shown in the following image:

2013 PowerShell Scripting Games Advanced Event 6 – The Grand Finale

For me, the Scripting Games have been a great learning experience this year. I’ve used many PowerShell features that I hadn’t used before such as splatting, ADSI, Workflows, and producing html webpages with PowerShell. I plan to write detailed followup blog articles on each of these topics over the next few months. Event 6 was definitely challenging since I hadn’t used workflows before but I also knew that’s what was really needed to accomplish the given task properly (In my opinion).

2013 PowerShell Scripting Games Advanced Event 4 – Auditors Love Greenbar Paper

The requirements for the 2013 Scripting Games Advanced Event 4 can be found here. For this event I created multiple functions and I’m going to quote chapter 6, section 1 of the Learn PowerShell Toolmaking in a Month of Lunches book written by Don Jones and Jeffery Hicks, published by Manning: A function should do one and only one of these things: Retrieve data from someplace Process data Output data to some place Put data into some visual format meant for human consumption

2013 PowerShell Scripting Games Advanced Event 3 – Bringing Bad Habits from the GUI to PowerShell

I’m seeing a trend with a lot of PowerShell scripters. Many of us have a GUI, non-scripting background and we moved to PowerShell because we didn’t want to be button monkeys clicking through the same options in the GUI day in and day out. I’ve always heard, if you’re going to do something more than once, do it (script it) in PowerShell. The trend I’m seeing is many are bringing their bad habit of wanting to repeat themselves over and over, day in and day out, to PowerShell.

People Who are Blogging About the 2013 Scripting Games

I’m sure that most people can easily find any of the blogs of the official judges from the 2013 Scripting Games. I recommend reading those blogs whether you’re competing in the scripting games or not since there’s a wealth of great information contained in them. The best place to find those blogs if you don’t know already is the Judges Notes section under the Scripting Games area on PowerShell.org so there’s no reason to duplicate them here.

2013 PowerShell Scripting Games Advanced Event 2 – Why NOT to use the Win32_ComputerSystem WMI Class

The majority of the entries I’ve seen for the Scripting Games event 2 are using the TotalPhysicalMemory property from the Win32_ComputerSystem WMI class to determine the total amount of physical memory in a server. The property name is “TotalPhysicalMemory” after all so that’s what it should contain, right? Not so fast, keep reading to discover why. Your manager needs an inventory of all of your company’s physical servers that are located in three different data centers which are in different parts of the country.

2013 PowerShell Scripting Games Advanced Event 2 – Attention to Detail is Everything

Here’s my approach to the 2013 PowerShell Scripting Games Advanced Event 2: When I start one of the Scripting Games events, I read and re-read the scenario because if you don’t understand the requirements, you can’t write an effect script, function, command, tool, etc. It’s not a bad idea to print out the event scenario and highlight the high-points. Here’s the scenario for Advanced Event 2 -An Inventory Intervention, I’ll place the items in bold that I would normally highlight on my printout:

Lessons Learned from the Scripting Games Advanced Event 1

This is a continuation from my previous blog titled 2013 PowerShell Scripting Games Advanced Event 1 – Parameters Don’t Always Work As Expected. This isn’t the exact script, but sections of it. You’ll notice at the bottom of the first image shown below, I retrieve the list of folder names from the files variable to keep from having to make another call to the file system. Going from one variable to another in memory is a cheap operation where as going to disk to retrieve something is more expensive from a resources standpoint.

2013 PowerShell Scripting Games Advanced Event 1 – Parameters Don’t Always Work As Expected

The scenario for this event states the following which has been paraphrased: Someone allowed log files to build up for around two years and they’re starting to causing disk space issues on the server. You need to build a tool to archive the log files because this has happened more than once. Applications write log files to a sub-folder in “C:\Application\Log”. Examples are C:\Application\Log\App1, C:\Application\Log\OtherApp, and C:\Application\Log\ThisAppAlso. The log files have random file names and a .

PowerShell Function to Determine the Active Directory FSMO Role Holders via the .NET Framework

Last week I posted a PowerShell function to determine what Active Directory domain controllers held the FSMO roles for one or more domains and forests. That particular function used the Get-ADDomain and Get-ADForest cmdlets which are part of the Active Directory PowerShell module. As it so happens, a friend of mine, Shay Levy who is a PowerShell MVP posted an article on PowerShell Magazine that uses a couple of one liners that use the .

Use PowerShell to Find Where the Current FSMO Roles are Assigned in Active Directory

A while back, I had a need to figure out with PowerShell what server in an Active Directory domain held the PDC Emulator FSMO Role. I found a script on a very popular blog site that figured it out by using a command similar to this: Get-ADDomainController -Filter * | where OperationMasterRoles -contains PDCEmulator | select Name While it accomplished what was necessary, I immediately thought “I can do better” and improved the one liner so it filtered left:

Using PowerShell v3 Features to Figure Out the Mysterious PowerShell Pipeline

I actually wrote this blog a couple of weeks ago and postponed it until I could do further testing because I thought of some scenarios where it possibly wouldn’t work. I wrote a couple of new blogs over the past couple of weeks and forgot about this one. Low and behold, I had rescheduled this blog for today and forgot all about it so I had two blogs posted today!

Mississippi PowerShell User Group – April Meeting Tomorrow Night!

The April Meeting of the Mississippi PowerShell User Group is tomorrow night, Tuesday April 9th at 8:30pm Central Time (CDT). This meeting will be held online (virtual) via Microsoft Lync, it is open to the public, and free to attend. The necessary software, the Lync attendee client, is also free so there’s no cost what-so-ever to attend. SAPIEN Technologies is our sponsor this month and they have provided several items including video training and a few different eBooks which will all be given away to random attendees during this months meeting.

The Scripting Games are Coming, The Scripting Games are Coming, The Scripting Games are Coming!

This years Scripting Games are scheduled to be kicked off during the PowerShell Summit North America 2013 which begins on April 22nd. That’s about two and a half weeks away at this point. In previous years, there have been two categories and it’s my understanding that this year, there will be three categories. One for PowerShell beginners, one for advanced PowerShell scripters as in previous years, and a new category for people who aren’t actually competing in the events but want to grade or rate other peoples scripts.

Book Review: Windows PowerShell Cookbook 3rd Edition

Two months ago I started reading Lee Holmes’s new Windows PowerShell Cookbook (3rd Edition). I read the epub version of the book using the iBooks App on my iPad which is my format, app, and device of choice for reading books. The epub version of the book is 1739 pages (the PDF version is 1036 pages). When I first started reading the book, my wife said “How could someone write a book with that many pages in it?

Florida PowerShell User Group March Meeting Video and Presentation Materials

The Florida PowerShell User Group March Meeting was this past Tuesday, March 19th. I was the speaker for this meeting and from what I’ve heard, my presentation was a huge success! The presentation and the Get-History output from the commands that were demonstrated during the presentation can be downloaded from [here][1]. Use posh031913 for the zip file password. We recorded the entire “PowerShell Fundamentals for Beginners” presentation: µ

I’m Speaking on PowerShell Fundamentals for Beginners at the Florida PowerShell User Group Meeting Tonight

Tonight, Tuesday March 19th, at 7pm eastern time, I’ll be presenting a session titled “PowerShell Fundamentals for Beginners” at the Florida PowerShell User Group meeting: During this presentation, I’ll be covering the concepts that were difficult for me to learn when I first started using PowerShell. We’ll start out by discussing where to find PowerShell, how to launch it along with issues you’ll experience when running the shell as a non-admin as well as execution policy related issues.

PowerShell Web Access Error: “Sign-in failed. Verify that you have entered your credentials correctly.”

Scenario: You’ve partnered with a company who is testing a new software application that uses PowerShell Web Access. You’ve provided this company with an Active Directory account named “Joe Doe”. This account is only allowed to sign into the PowerShell Web Access interface of a server named WWW in the mikefrobbins.com domain. Password policies in this domain use the default settings. Forty-two days after the account was created, you receive an email from the partner company asking if something has been reconfigured because they are unable to sign into PowerShell Web Access.

Using a PowerShell Quote List Function to Work with an Array of Strings

Reblogged from Mississippi PowerShell User Group:Recently, during one of our test user group meetings that Rohn and I had, I was using an example of storing multiple server names into an array to then work with them. This is how I would normally accomplish this task, that is unless I pulled the names directly from Active Directory: $servers = 'server1', 'server2', 'server3', 'server4', 'server5', 'server6' $servers ](https://mspsug.com/wp-content/uploads/2013/03/ql1.png) Rohn showed me the way he has been accomplishing this sort of task which requires less typing:

Use PowerShell to add an additional Domain Controller to an existing Windows Server 2012 Active Directory Domain

Recently, I decided to add a second domain controller to my mikefrobbins.com domain. The existing server and this new server that will become a domain controller both run the Microsoft Windows Server 2012 operating system and both were installed with the default installation type of server core (no GUI). Even though the GUI can be turned on and off in Windows Server 2012 (unlike in Windows Server 2008 and 2008 R2), I prefer not to add the GUI unless absolutely necessary.

Reminder: Mississippi PowerShell Users Group Meeting Tonight!

Tonight from 8:30pm to 10pm Central Time I’ll be presenting at the first ever Mississippi PowerShell Users Group online (virtual) meeting. The topic for my presentation is Parsing the Event Logs of Windows Based Systems with PowerShell. We’ll start out with a basic overview via a few PowerPoint slides: Next and for the majority of the meeting, I’ll be demonstrating how to parse the event logs using PowerShell. This will include how to figure out what cmdlets can be used to parse the event logs, demonstrating each parameter set of those cmdlets, using WMI, the new CIM cmdlets, and finally using the .

Become a PowerShell SuperHero with SAPIEN Technologies PowerShell Studio 2012

I saw a tweet last week titled The Friday Funny: The Best T-Shirts at #RSAC and while those t-shirts are cool, they’re not nearly as awesome as the ultimate technology related T-Shirt which is from SAPIEN Technologies and when combined with their PowerShell Studio 2012 product can turn you into a PowerShell SuperHero as seen in the following image: _Note: The PowerShell enthusiast depicted in the previous image is not an actual superhero, he is only portraying one.

Use PowerShell to Remotely Enable Firewall Exceptions on Windows Server 2012

You’re attempting to view the event logs of a couple of remote Windows Server 2012 servers that have been installed with the default installation type of server core (No GUI). You receive the following error when attempting to connect to these servers using the Event Viewer snapin in an MMC console: “Computer ‘DC01.MIKEFROBBINS.COM’ cannot be connected. Verifythat the network path is correct, the computer is available on thenetwork, and that the appropriate Windows Firewall rules are enabledon the target computer.

Book Review: Learn Active Directory Management in a Month of Lunches

The Learn Active Directory Management in a Month of Lunches book by PowerShell MVP Richard Siddaway is now available on the Manning.com website via their Early Access Program (MEAP). As Richard says in Chapter 1: This book is “A straight forward guide to administering Active Directory delivered in lunch sized pieces”. It focuses on what you need to know to do your job as an Active Directory administrator in the real world.

Unable to View a Shared Desktop or Application in a Microsoft Lync 2013 Meeting

Recently while using Microsoft Lync 2013 to view a shared desktop or application in a meeting, I experienced an issue where I could only see a blank white screen as shown in the image below: Event ID 301, Microsoft Office 15 Alerts was logged in the event log with the following details: Microsoft Lync CLSID: {00000000-0000-0000-0000-000000000000} CATID: {9B179D6E-9BDB-454b-BE3D-89F9A792BD39} The ActiveX Compatibility setting disabled loading this object to help protect your security.

Install SharePoint 2013 with PowerShell to Prevent the Dreaded Database Names with GUID’s

Do you have a shared SQL Server back-end for multiple SharePoint farms? Do you like being able to easily tell which SharePoint databases go with which SharePoint farm? If you install SharePoint 2013 using the GUI wizard, you’ll end up with database names that have GUID’s on them that look like this: This blog will guide you through installing SharePoint Foundation 2013 with PowerShell so you’ll have full control over the database names.

Use PowerShell to Create a Scheduled Task that Uses PowerShell to Pause and Resume AppAssure Core Replication

In this scenario there are multiple AppAssure Core servers, one at each physical location that is used to backup the local servers. Each AppAssure Core server is setup to replicate its data to an offsite AppAssure Core server at a separate physical location across a wide area network for disaster recovery purposes. Due to bandwidth constraints, you want to pause the replication between the AppAssure Core servers during normal business hours.

PowerShell Remoting Insanity with AppAssure and the Invoke-Command Cmdlet

Although simple, I thought I would share the following PowerShell script since it’s neat due to the fact that it uses the PowerShell remoting Invoke-Command cmdlet to retrieve a list of server names that are protected by an AppAssure Core server where the status is not protected, then it uses the output of that portion of the script (Nesting in parenthesis) as the input for the ComputerName parameter of the outer portion of the script which uses another Invoke-Command to attempt to start the AppAssureAgent service on those servers that were returned by the nested portion of the script:

Grand Prize Winner of TrainSignal’s Jeff Hicks PowerShell Challenge

A little over a month ago, I entered a PowerShell contest named Jeff Hicks' PowerShell Challenge that was held by TrainSignal. Each day, a PowerShell related question was posted and contestants were given 24 hours to send an email to TrainSignal with the answer. At the end of the competition, the individuals who answered all four days worth of questions correctly were entered into a drawing and I was notified that I was the winner of this “grand prize”.

Using PowerShell Remoting to Manage Multiple AppAssure Core Servers

In my last blog, I was logged directly into an AppAssure Core server via remote desktop and was running PowerShell commands in the PowerShell console directly on the server. Managing your servers by RDPing directly into them is a bad practice in my opinion. In this blog, I’ll explore a few options that could be used to manage an AppAssure Core server with PowerShell without having to resort to logging directly into it with Remote Desktop.

Using PowerShell to Determine AppAssure Agent Status and Version

The Get-ProtectedServers PowerShell cmdlet which is part of the AppAssure PowerShell Module that’s installed on your AppAssure Core server version 5.3.1 or higher allows you to determine what servers are being protected by a particular AppAssure Core server. Since I’m running PowerShell version 3 on the AppAssure Core server shown in the example below, I didn’t have to explicitly import the AppAssure PowerShell module, if you’re running PowerShell version 2, you would need to run Import-Module AppAssurePowerShellModule prior to running the Get-ProtectedServers cmdlet.

Dell AppAssure Version 5.3.1 Adds PowerShell Support

I’ve been working with Dell AppAssure for several months now and in their version 5.3.1 release they’ve added PowerShell support via a module named AppAssurePowerShellModule. There are a total of 31 cmdlets in this Module: One thing that I thought was interesting is according to AppAssure’s documentation on how to import their PowerShell module, it states that PowerShell version 3 is preferred. Over the next few weeks I’ll cover some of the tasks that I’ve used the cmdlets in this module to accomplish to include certain tasks that can’t be accomplished at all in the GUI.

The Perfect New Year’s Resolution: Lose Weight & Learn PowerShell in the Process

The most common New Year’s resolution has to do with either losing weight or getting yourself into better shape. I thought I would share the secret of how I lost 50+ pounds, kept it off, and learned PowerShell in the process. Sound like something worth doing? Let’s face it, there’s no easy way to lose weight, although you don’t have to starve yourself to lose those pounds either. Losing weight takes time, you didn’t put it on overnight and you’re not going to take it off overnight.

Book Review: Learn Windows PowerShell 3 in a Month of Lunches, Second Edition

Today makes 28 days since I started reading the “Learn Windows PowerShell 3 in a Month of Lunches, Second Edition" book written by Don Jones and Jeff Hicks, published by Manning. ](/images/2012/11/jones3_cover150.jpg)This book, shown in the image on the left, contains 28 chapters and is designed to be read one chapter a day. One hour is enough time to read a single chapter and work through the re-enforcing lab exercises at the end of that chapter.

Book Deals for December 24th and December 25th

Today and tomorrow (Christmas Eve and Christmas Day) Manning.comhas half off Everything! Just use promo code celebrate50 when checking out. You could purchase all of the latest PowerShell books that are published by Manning for less than $100 dollars: ](/images/2012/11/jones2_cover150.jpg)](/images/2012/12/powershell-books1.png)It’s a perfect time to learn PowerShell since the world didn’t come to an end! µ

Save 50% Off on the New PowerShell Deep Dives MEAP Book!

Save 50% on PowerShell Deep Divesand other selected books. Just enter psddlaunch50 in the Promotional Code box when you check out. Expires Wednesday, December 28. Only at manning.com. ](/images/2012/12/hicks_cover150.jpg)Here’s your chance to learn from the best in the business. PowerShell Deep Divesis a trove of essential techniques, practical guidance, and expert insights you earn only through years of experience. In the book’s 4 parts-Administration, Scripting, Development, and Platforms-you’ll find 29 concise, brilliantly-clear chapters.

Book Review: Microsoft Windows PowerShell 3.0 First Look

About a week ago I started reading the “Microsoft Windows PowerShell 3.0 First Look” book written by Adam Driscolland published by Packt. ](/images/2012/12/powershell-3-first-look.png)One of the things I like about this book is the ability to read it in about a week since it’s only seven chapters long. In my opinion, its intended audience is people who are already somewhat familiar with PowerShell version 2 that are looking for a way to quickly get up to speed on the new features in version 3.

The PowerShell Deep Dives Book is now available via the Manning Early Access Program (MEAP)

](/images/2012/12/hicks_cover150.jpg)The PowerShell Deep Dives Bookis now available for purchase via the Manning Early Access Program (MEAP). This should be an awesome book based on the list of authors and the chapter titles. If you’re someone who has found interesting and useful information on my blog site, you’ll definitely enjoy reading the chapter that I’m writing in this book. Click on the book image for more information. µ

Determine what OU a Computer Account is in with PowerShell

Problem: You’ve been asked to send an email to someone with the location in Active Directory (what Organization Unit or OU) where a particular computer account is located. Solution: As you could have probably guessed, the solution is to query Active Directory with PowerShell and use the Send-MailMessage cmdlet to send the results to the recipient: Send-MailMessage -Body ((Get-ADComputer pc01).DistinguishedName | Out-String) -SmtpServer mail.mikefrobbins.com -From me@mikefrobbins.com -Subject 'OU Location of PC01' -To you@mikefrobbins.

PowerShell: Determine Exposed WMI and CIM Class Methods

I sat through the Arizona PowerShell User Groupmeeting yesterday evening via a Lync online meeting. Don Jones was the guest speaker this month. His session was on generating reports from PowerShell. It was a super cool session and if you’re not taking advantage of user group meetings, you’re really missing out. Interface Technical Trainingwas the sponsor for the user group meeting this month. I’m currently working my way through their PowerShell video training series which I’ve been very impressed with so far.

The Unboxing Experience: Learn Windows PowerShell 3 in a Month of Lunches, Second Edition Book

When I arrived at home after work yesterday, I found a surprise box on my desk: ](/images/2012/11/ps3-book1.jpg)A quick look at the label on the side of the box gave away its secret contents. It was my new, hot off the press, copy of “Learn Windows PowerShell 3 in a Month of Lunches, Second Edition” book written by Don Jones and Jeffery Hicks, published by Manning: ](/images/2012/11/ps3-book2.jpg)I have to say that it was packed very well for a book.

PowerShell Version 3 Installation Failure on Windows Server 2008 R2 Server Core Installation (no-GUI)

You have a server which runs the Windows Server 2008 R2 with SP1 operating system that was installed using the “Server Core Installation” option (no-GUI): ](/images/2012/04/ps2-2008r2core01.png" height=“480)You’ve given this server a name, added it to the domain, configured the IP address settings, and configured options 1 -3 in the “Configure Remote Management” portion of sconfig as shown in the following image: ](/images/2012/11/sc-ps3-failure1.png” height=“503)PowerShell version 2 works fine on the server, but you’ve been tasked with loading PowerShell version 3 on it.

PowerShell Studio 2012: PowerShell Cache Builder has Stopped Working

I won a copy of PowerShell Studio 2012at PowerShell Saturday 003in Atlanta last month. It’s an awesome product to win and the best giveaway of the entire event (in my opinion). I ran into an issue the first time I ran the product after the installation and thought I would share the problem, cause, and solution so anyone who experiences the same issue can easily resolve it. The installation itself completed without issue.

Calculate What Date Thanksgiving is on with PowerShell

A quick search on the Internet turned up this definition for Thanksgiving: “Thanksgiving Day is a time for many people to give thanks for what they have”. Based on that definition, I have a long list of things to be thankful for, however, this is a technology related blog site with an emphasis on PowerShell so I’ll focus on being thankful for my PowerShell friends, the PowerShell community, an employer who supports my PowerShell addiction, and a wife & children who put up with me spending countless hours on the computer learning more about PowerShell.

PowerShell Magazine Brain Teaser Winner!

I received notification yesterday from PowerShell Magazinethat I had won last weeks PowerShell Brain Teaser to “Assign a list of processes to a variable and output it to the console”. The prize for winning that particular brain teaser was an eBook version of the recently released “Learn Windows PowerShell 3 in a Month of Lunches, Second Edition” book written by Don Jones and Jeffery Hicks: ](/images/2012/11/jones3_cover150.jpg)This weeks brain teaser is “Find a list of all IP addresses assigned to the local system”.

PowerShell Book Deals for Monday – November 19th, 2012

Manning.comhas three PowerShell Books onsale today, Monday - November 19th, 2012. The promo code to receive the discount on each book is dotd1119cc. Save 50% off “Learn PowerShell Toolmaking in a Month of Lunches” written by Don Jones and Jeffery Hicks: ](/images/2012/12/jones4-cover150.jpg)Save 44% off “Learn Windows PowerShell 3 in a Month of Lunches, Second Edition” written by Don Jones and Jeffery Hicks: ](/images/2012/11/powershell3.jpg)Save 44% off “PowerShell in Depth” written by Don Jones, Richard Siddaway, and Jeffery Hicks:

PowerShell Summit North America 2013 Apparel & Gift Store

I thought I would share the “unboxing experience” of my PowerShell Summit North America 2013 T-Shirt. The T-Shirt arrived in about a week with the economy shipping choice. It arrived in a mail type bag as shown below. The shirt was folded and had what I would call a brown paper ribbon around it with a cafe press sticker and a thank you card with my receipt in it: ](/images/2012/11/ps-summit-shirt-unboxing.jpg)The color I chose was charcoal.

Book Deals: Three Awesome PowerShell Related Books Onsale Today For 50% Off

Manning.comhas three awesome PowerShell related books onsale today for 50% off with promo code dotd1117cc. Learn Windows IIS in a Month of Luncheswritten by Jason Helmick ](/images/2012/11/helmick_cover150.jpg)Windows PowerShell in Action, Second Editionwritten by Bruce Payette ](/images/2012/11/payette2_cover150.jpg)Learn PowerShell Toolmaking in a Month of Luncheswritten by Don Jones & Jeffery Hicks ](/images/2012/12/jones4-cover150.jpg)View this deal. µ

Remove or Change Items on your PowerShell People Profile

First, start out by reading my blog from two days ago titled “Meet the People of PowerShell at PowerShell.org/People and PowerShell.net” otherwise you’ll be starting in the middle of the story and this blog will only end up causing confusion. ](/images/2012/11/powershell-net-logo.jpg" height=“70)To change an item on your PowerShell People profilepage, the item has to be removed and then re-added. With that said, we’ll cover removing an item and see the previous blog article referenced in the first paragraph for how to add it back.

Book Giveaway: Learn Windows PowerShell 3 in a Month of Lunches, Second Edition

](/images/2012/11/powershell3.jpg" height=“150)PowerShell Magazinehas a “Brain Teaser” book giveaway going on where you post how to accomplish a specific task in PowerShell to try to win a copy of the “Learn Windows PowerShell 3 in a Month of Lunches, Second Edition” book written by Don Jones and Jeffery Hicks. This weeks brain teaser is: “Assign a list of processes to a variable and output it to the console”. µ

Meet the People of PowerShell at PowerShell.org/People and PowerShell.net

Do you consider yourself a PowerShell person? If you haven’t heard, there’s a new online directory of the PowerShell community called PowerShell People. The site is a place to find other PowerShell enthusiast’s blogs, webs sites, twitter feeds, and other items they’ve chosen to share. ](/images/2012/11/powershell-net-logo.jpg" height=“70)What’s needed to get a profile page on the PowerShell People community site? Simply a knowledge of PowerShell. You heard me correctly, a knowledge of PowerShell is the only prerequisite for creating a PowerShell People Profile.

PowerShell: Save-Help for Modules that Aren’t Installed on the Local Computer without Copying Files

In my last blog article on this subject, I showed how to copy the PowerShell module manifest file from a server with the module you want to download the help for to the local computerto trick it into thinking the module was installed locally, but copying files can get messy and isn’t really a robust way of accomplishing that task. The first method I used did get me thinking about this process though.

PowerShell Book Giveaways

There are a couple of PowerShell book giveaways going on that you may be interested in: PowerShell Magazineis giving away a copy of “Microsoft Windows PowerShell 3.0 First Look” written by Adam Driscoll. ](/images/2012/11/powershell3-firstlook.png" height=“150)Alvin Ashcraft’s Morning Dewis giving away two copies of “Learn Windows PowerShell 3 in a Month of Lunches, Second Edition” written by Don Jones & Jeffery Hicks. ](/images/2012/11/powershell3.jpg” height=“150)µ

The Scripting Guy Discusses Remote Management with PowerShell Version 3

The Scripting Guy (Ed Wilson) will be presenting at the Arizona PowerShell Users Grouptoday, Wednesday November 7th from 3:30 to 5pm MST (Mountain Standard Time). If you can’t be there in person, here’s a link to the Arizona PowerShell Users Group pagewhere the information to join the Lync online meeting is posted. I attended last month’s online meeting and you’ll want the Microsoft Lync 2010 Attendee fat client(not the web client).

PowerShell: Save-Help for Modules that Aren’t Installed on the Local Computer

Update-Helpand Save-Helpare new PowerShell version 3 cmdlets which allow you to initially download PowerShell help and keep the local PowerShell help files updated that are installed on your computer and available via the Get-Help cmdlet. In PowerShell version 3, Save-Help allows the updated help files to be saved to a location where a machine that doesn’t have Internet access can update it’s help from. The problem is that in order to save help for a module, that module has to exist on the local computer that’s performing the actual download otherwise an error will be generated:

IT Pro’s are in for a Rude PowerShell Awakening When Upgrading Their Certifications to Windows Server 2012

I’ve had a lot of irons in the fire this year and haven’t had time to dedicate to taking any certification tests year to date. This year, I’ve spent much of the time that I would have normally spent studying for certification tests, learning PowerShell instead. I competed in the Scripting Games earlier in the year. I finished in third place in the beginner class and lead the beginner class for more than half of the games:

When Trying to Install PowerShell Version 3.0 You Receive the Message: “The Update is Not Applicable to Your Computer”

You’ve decided to install PowerShell version 3.0 on your computer. Your computer meets the requirement of running Windows 7 with Service Pack 1, Windows Server 2008 with Service Pack 2, or Windows Server 2008 R2 with Service Pack 1. If you’re running Windows 8 or Windows Server 2012, you already have PowerShell version 3.0 installed. There are several different ways to check the operating system version and service pack level. In the following screenshot, I’ve run “winver.

Piping PowerShell Output to the Clipboard

It’s definitely beneficial to attend technology events so you can talk to other IT Pro’s. This past weekend I presented a session at PowerShell Saturday in Atlantaand while at the speaker dinner I made a comment about a new version of the PowerShell Community Extensionsbeing released. The only cmdlet that’s part of that module that I use all of the time is Out-Clipboard which allows you to paste the output of a PowerShell command into notepad, Word, an email, etc:

Use PowerShell to Create Active Directory User Accounts from Data Contained in the Adventure Works 2012 Database

This past Saturday, I presented a session at PowerShell Saturday 003in Atlanta. Towards the end of the presentation, I created 290 Active Directory user accounts by using the information for employees contained in the Adventure Works 2012 database. This is actually a PowerShell script that I whipped up Friday night at the hotel after the speaker dinner. I populated some demographic information by joining multiple tables together from that particular database.

PowerShell Voodoo for Beginners

I’ll be speaking this Saturday, October 27th at PowerShell Saturday 003in Atlanta. My session is officially titled “PowerShell Fundamentals for Beginners”. A guest blogthat I wrote about PowerShell, my session, and the event was published yesterday on the Hey, Scripting Guy! Blog at Microsoft TechNet so take a look at it and the brief description of my sessionon the PowerShell Saturday 003 website for more details. It’s getting close to Halloween so I picked up some special treats in the New Orleans area this week to give out during my session to people who answer questions:

PowerShell 3.0 Get-Help -Online Parameter Generates an Error When Default Browser is Google Chrome

I’m a big fan of the online version of PowerShell help. I also use Google Chrome as my default web browser. Since I’ve moved to Windows 8 and PowerShell 3.0, using the Get-Help PowerShell cmdlet with the Online parameter generates an error. There’s actually two different errors that I’ve seen a lot of, the first one is because the online help doesn’t appear to exist and this error occurs regardless of what web browser you’re using:

Use PowerShell to Create a New Active Directory Forest on Windows 2012 Server Core Installation (no-GUI)

You have a fresh installation of Windows Server 2012 that was installed using the default installation type of server core installation (no-GUI). This server will be the first domain controller in a brand new Active Directory forest. Log into the server and launch PowerShell by typing “powershell.exe”. You’ll need to first add the AD-Domain-Services role to the server: Add-WindowsFeature AD-Domain-Services The installation of this role completes and a restart is not required:

Use PowerShell to Obtain a List of Processes Where the Executable has been Modified in the Past 90 Days

Use PowerShell to obtain a list of currently running processes where the executable file has been modified in the past 90 days. The number of days is a parameterized value so it can be specified when running the script without having to manually modify the script each time you want to change the value. The script uses a foreach loop to iterate through each individual process that is returned by the Get-Process cmdlet.

PowerShell v3 Where-Object Syntax Produces Different Results Than v2 Syntax

I posted a blog yesterday about a PowerShell issue I was experiencing and the problem ended up being due to the new PowerShell version 3 Where-Object Syntax producing different results than the PowerShell version 2 Where-Object syntax. Piping Get-Volume to Where-Object and filtering on the drive letter using the version 3 syntax appears to be case sensitive. It doesn’t return results when using a lower case ‘c’: Get-Volume | where DriveLetter -eq 'C' Get-Volume | where DriveLetter -eq 'c' Using the PowerShell version 2 syntax with Where-Object does not appear to be case sensitive.

PowerShell: Filtering Left Could Produce Different Results Than Filtering with Where-Object

While doing some testing on my Windows 8 machine today, I discovered an issue where Filtering Left could produce different results than filtering with the Where-Object cmdlet. Nothing special here. Just using the Get-Volume cmldet and filtering left with its DriveLetter parameter. Using either an upper or lowercase ‘C’ returns the same results: Get-Volume -DriveLetter 'C' Get-Volume -DriveLetter 'c' Using the Where-Object cmdlet to do the filtering, while not a best practice when the filtering can be accomplished earlier in the pipeline, should return the same results or at least you would think it should.

Use PowerShell to Copy the Group Membership of one Active Directory User to Another Active Directory User Account

You have an Active Directory user account and you want to make a second user a member of the same groups without removing the second user from any groups they may already be a member of. I prefer using the Quest PowerShell Cmdlets for Active Directoryfor doing my AD administration work. They have been downloaded and installed on the system this is being run from. The Quest snap-in has been added to make the cmdlets available.

Use PowerShell to Change the Snapshot Reserve on EqualLogic SAN Volumes

You have a customer who has an EqualLogic PS Series Storage Area Network (SAN) where the Snapshot Reserve for many of their SAN volumes is currently set to more than 100% of the actual volume size. The SAN also has several volumes where the snapshot reserve is set to exactly 100%, other volumes where the snapshot reserve is set to less than 100%, and others that don’t have or need snapshots configured at all.

Use PowerShell to Determine When Your DHCP Lease Expires

This blog post applies to only Windows 8 and Windows Server 2012. Want to know how much time there is until your current DHCP leases expire? Get-NetIPAddress -PrefixOrigin Dhcp | select InterfaceAlias , IPAddress, ValidLifetime I have 23 hours, 47 minutes, and 46 seconds until my current DHCP lease expires on one of my network interfaces and 22 seconds more than that left on the other one. Want to know the exact date and time of when they expire?

Targeting Down Level Clients with the Get-CimInstance PowerShell Cmdlet

This past weekend, I attended PowerShell Saturday 002 in Charlotte, NC. One of the sessions I attended was “Discovering the Power of WMI & PowerShell in the Enterprise” by Brian Wilhite. One of the cool things that Brian covered in his session was how to use the new PowerShell version 3 Get-CimInstance cmdlet to target down level clients that don’t have PowerShell installed or don’t have PowerShell remoting enabled. There’s no parameter to change the protocol on the actual Get-CimInstance or New-CimSession cmdlets, but it can be added using the the New-CimSessionOption cmdlet.

Use PowerShell to Display IIS Application Pool Identity Account Passwords in Clear Text

It’s fairly common to see the identity for an IIS application pool changed to a domain user account. The following image shows three application pools, the DefaultAppPool has the default settings, the www app pool has a Managed Service Account specified, and the wwwDev app pool has a standard domain user account specified: When a standard user account is specified, the password is entered as shown below: I’ve used what you would think is a super secure password, generated by KeePass:

PowerShell Saturday 002 | Charlotte NC | September 15, 2012

If you haven’t heard, there’s a PowerShell Saturday technology event this weekend in Charlotte, NC (Saturday, September 15, 2012). It’s going to be awesome based on the list of sessions and speakers they have lined up which rivals conferences that cost hundreds or possibly even thousands of dollars to attend. It’s also similar to the SQL and SharePoint Saturday technology events that I’ve attended for the past few years so I can speak from experience, they’re definitely worth the time and effort to attend.

A Quarter of a Million Hits & MrPowerShell.com Announcement

This month makes 3 years that this blog site (mikefrobbins.com) has been live. I’ll reach a quarter of a million hits on this blog site before the end of the day today! You’ll notice that PowerShell has become more and more the focus of what I’m blogging about. See how much larger the word “PowerShell” is than everything else in the category cloud on the right side of this site. Why?

Use PowerShell to Check for Processor (CPU) Second Level Address Translation (SLAT) Support

The hardware requirements for using Hyper-V to run virtual machines on a Windows 8 client states that a 64-bit system that has a processor (CPU) that supports Second Level Address Translation (SLAT) is required. A minimum of 4GB of RAM is also required. How do I know if my Processor (CPU) supports Second Level Address Translation? You could do like most blogs on the Internet state and use Coreinfo: You have two additional choices if you already have Windows 8 or Windows Server 2012 Installed.

Finding Aliases for PowerShell Cmdlet Parameters

Many PowerShell cmdlet parameters have aliases such as “Cn” for ComputerName. These aliases aren’t well documented and even viewing the full help for a cmdlet doesn’t show them. The following command can be used to display a list of all the parameters for a particular PowerShell cmdlet and any aliases that exist for those parameters: (Get-Command (Read-Host "Enter a PowerShell Cmdlet Name")).parameters.values | select name, aliases One thing to keep in mind is this is a list of all the parameters from all parameter sets which means some of them are mutually exclusive and can’t be used with one another.

The Mount Option for ISO’s is MIA after installing a Third Party CD/DVD Application on Windows 8

There’s no longer a mount option for ISO’s after installing a third party CD/DVD burning application such as ImgBurn on Windows 8. The Mount option is MIA (missing in action): There’s no reason to panic or resort to a system restore to resolve this issue. Simply click “Choose default program” as shown in the previous image and select “Windows Explorer”: The “Mount” option will then be available when right clicking on an ISO image:

How to Unmount an ISO file in Windows 8

Prior to Windows 8, I used a program called Virtual CloneDrive to mount ISO’s. Once the ISO was mounted, it could easily be unmounted by selecting the “Unmount” option: ISO’s can natively be mounted in Windows 8, but there’s no “Unmount” option. To unmount an ISO, right click on the drive letter of the mounted ISO and select “Eject”: While writting this blog, I also discovered that “Eject” is an option with Virtual CloneDrive as shown in the first image that can be used to unmount an ISO.

How to Install the Remote Server Administration Tools (RSAT) on Windows 8 RTM

There’s good news and bad news. The bad news is based on what I’ve read on the Internet, the Remote Server Administration Tools for Windows 8 RTM won’t be available until next month, although that makes sense because Windows Server 2012 won’t be available until next month either. So what do I use in the mean time? The good news is that it’s possible to install the RSAT for Windows 8 Release Preview on Windows 8 RTM if you can’t wait.

How to Activate Windows 8 RTM Enterprise Edition

If you installed Windows 8 RTM Professional, you were prompted for a license key before it would even get started with the installation, but if you installed Windows 8 RTM Enterprise Edition, it didn’t even prompt for a license key during the installation process. Going to “Windows Activation” in control panel, shows “Error Code 0x8007232B DNS name does not exist.” in the Activation details section: I couldn’t find a place to enter a license key so they’re probably assuming you have a Key Management Service (KMS) server running on your network since this is “Enterprise” edition.

How to Install the Exchange 2010 Management Tools on Windows 8 RTM

This is definitely unsupported so be sure to read the disclaimer on the right side of this blog before continuing. Read this blog article completely before attempting this process. You’ve just reloaded your work computer with Windows 8 RTM that you downloaded from MSDN or TechNet and you need to install the Exchange Server 2010 Management Tools so you can manage your Exchange server without having to log into it whether it be with the GUI orwith PowerShell.

Error 0x800F0906 When Trying To Add .NET Framework 3.5 to Windows 8 RTM

The Windows 8 RTM was released yesterday to TechNet subscribers and this morning I decided to start the day off by reloading my business computer. I’ve been running the Release Preview on a netbook and on some VM’s without issue. Everything seemed to go well until I tried to load several applications that required the .NET Framework 3.5. Each of them failed to install stating they were unable to add the .

Working with WMI Just Got a Lot Easier Thanks to PowerShell Version 3

Working with WMI just got a lot easier thanks to the new tabbed expansion feature of the Get-CimInstance cmdlet in PowerShell version 3 that makes discovering namespaces and classes a much simpler process. A static blog wouldn’t do this feature justice so I decided to record a video for this one: Let me know what you think and if you would like to see more of these types of videos.

Hyper-V Live Merge Snapshot Feature in Windows Server 2012

One of the best new features I’ve noticed while testing Hyper-V on the release candidate of Windows Server 2012 is the ability to merge snapshots while a virtual machine is running without the need for a restart as was required by Hyper-V in Windows Server 2008 R2. The Windows 7 VM shown below is currently running and it has one snapshot: When a snapshot is created a .avhdx file is created and any changes from that point forward are written to it instead of the .

Use Data Stored in a SQL Server Database to Create Active Directory User Accounts with PowerShell

I need a few Active Directory users created in my mikefrobbins.com test environment so I thought why come up with fake information when I could use information that I already have in a SQL Server database? The Employees table in the Northwind database looks like an easy enough candidate since all the data I need is in one table. This is about the concept and not about seeing how complicated I can make this process.

Can the PowerShell ISE be Installed on Windows Server 2012 Server Core Installation?

I noticed a few days ago that the PowerShell ISE is an available feature on Windows Server 2012 Release Candidate when running the Server Core Installation (no GUI): Does that mean the PowerShell ISE can run on Server Core in Windows Server 2012 unlike in Windows Server 2008 R2? Let’s find out. The installation takes a long time and then you’re prompted to restart when it’s complete: Finally when the restart is finished and you log in, Server Manager will be loaded and you’ll discover that you now have what’s called “Minimum Server Interface”:

Querying a SQL Server Database from PowerShell

A few days ago, I wrote a PowerShell script on my computer that would ultimately be used on a different computer to automate a specific task. One of the things this script did was to query a SQL Server database which worked fine on my computer. After moving the script, it didn’t take long to figure out that the other computer didn’t have the necessary SQL PowerShell snap-in or module. My goal was to install the minimum features of SQL Server 2008 R2 to be able to run Transact SQL from PowerShell against a remote SQL Server.

Want a Start Menu in Windows 8 Release Preview?

The registry hack from the Customer Preview version no longer exists so I tried a few third party products and settled on the free Classic Shell program: I only chose to install the “Classic Start Menu” portion: Now I have a start menu in Windows 8 Release Preview: This doesn’t remove or replace any of the Metro interface capabilties. You can still move the mouse to the very lower left hand corner of the screen and switch to Metro:

No Soup, I Mean No PowerShell -Version 2 For You Windows 8 and Windows Server 2012

Be sure to start off by reading my previous blog article titled Error When Running PowerShell -Version 2 on Windows 8 and Windows Server 2012 if you have not previously read it since attempting to run PowerShell in version 2 mode generates an error on a default installation of Windows 8 or Windows Server 2012. In PowerShell version 3, you can access PowerShell version 2 by running “PowerShell.exe -Version 2” (or “powershell -v 2”):

Error When Running PowerShell -Version 2 on Windows 8 and Windows Server 2012

Windows 8 Release Preview On a fresh installation of the Windows 8 Release Preview, when attempting to run PowerShell.exe -Version 2, you’ll receive the following error: “Version v2.0.50727 of the .NET Framework is not installed and it is required to run version 2 of Windows PowerShell.” The following error message is generated if you attempt to run the same command from the PowerShell ISE: “powershell : V e r s i o n v 2 .

Collections Are More Transparent In PowerShell v3

In PowerShell version 2, it took me a while to figure out why using the dotted notation method of selecting a property worked at times and not at others. In the following example $v2 is a variable so I’m able to select the CPU property by using $v2.cpu or accomplish the same thing by piping $v2 to Select-Object with the -ExpandProperty parameter and specifying the CPU property: In the scenario shown in the following image, why didn’t $v2.

2013 a Microsoft Software Release Odyssey

An Odyssey is defined as a “Long and Eventful Journey”. The first version of Microsoft Office that I can remember supporting professionally is Office 4.3 and the first version of Exchange was 5.5. It’s been a long an eventful journey to get from the days of those versions of software to where we are today with the preview versions of SharePoint 2013, Exchange 2013 , Lync 2013, Office Web Apps Server, Project 2013, Visio 2013, and Office Professional Plus 2013 being announced in addition to the already available release preview of Windows 8, and release candidate version of Windows Server 2012.

Use PowerShell to List Stopped Services that are Set to Start Automatically While Excluding Delayed Start Services

Have you ever had 67 emails about services on your servers being up and down from your monitoring solution? It’s not a good feeling and those emails are only about the ones that monitoring is setup for. What other services could be stopped that aren’t being monitored? Wouldn’t you like a quick and easy way to check whether or not all of the services that are set to start automatically are actually running?

Can iSCSI Targets be Renamed on an EqualLogic PS Series Storage Area Network?

I received a tweet from someone a few days ago asking if it was possible to rename an iSCSI target on an EqualLogic PS Series Storage Area Network (SAN). I wasn’t sure, but it was interesting enough to research and determine if it was possible or not. Based on a screenshot provided by this person, they wanted to change the default iSCSI target name prefix so new volumes that are created have a different target prefix.

Want VM Reliability and Uptime? Hyper-V on Server Core

While at TechEd last month I heard two things that I’ve been preaching for a while. Server Core installation (no-GUI) is the recommended installation type beginning with Windows Server 2012. I’ve been saying this for a while when it comes to Windows Server 2008 R2. Server Core: Reliability and Uptime In each of three datacenters that I support there are multiple Hyper-V servers that run Windows Server 2008 R2 w/SP1 with the Core Installation (Server Core).

Use PowerShell to Determine What Roles are Added When Turning a Windows 2012 Server into a Domain Controller

Goal: Determine what roles are installed when turning a Windows Server 2012 machine into a domain controller. I started out by using PowerShell to save a list of what roles are installed on a plain vanilla 2012 server that has the full GUI installation. The following one liner would be used in PowerShell version 2 to accomplish this task and the syntax is compatible with version 3: Get-WindowsFeature | Where-Object {$_.

Use PowerShell to Manage an EqualLogic SAN

Today my Use PowerShell to Manage an EqualLogic SAN guest blog was published on the Hey, Scripting Guy! Blog on Microsoft TechNet. Click on the link above or on the image to the left to view it. µ

PowerShell Magazine: My Favorite PowerShell Tips & Tricks

My first article for PowerShell Magazine titled: Mike F Robbins’s Favorite PowerShell Tips & Tricks was published today. Be sure to check it out using the link above or click on the Tips and Tricks sticky note image on the left. Also, check back tomorrow for another guest blog announcement! µ

Welcome to PowerShell Hell

I finally figured out why the error messages in PowerShell are in bright red. It’s because it’s the color of flames and/or red hot coals and it means you may be in PowerShell Hell. That’s what recently happened when I updated the Antivirus on my PC from Eset NOD32 version 4 to version 5. A few days after updating, I was in PowerShell Hell as shown below: When trying to run Get-ChildItem against WSMan:localhost, I received the following:

ASP.NET v4.0 Application Pools Don’t Show Up in IIS

On a Windows Server 2008 R2 Machine, a default operating system installation was performed along with installing all of the Windows Updates to include the .NET Framework v4.0, then IIS was installed. On this particular server, the ASP.NET v4.0 Application Pools didn’t show up automatically in IIS: My guess is this is because the .NET Framework 4.0 was installed before IIS. To resolve this issue open a command prompt as administrator (elevated privileges if UAC is enabled), change into the .

Places to Learn More About PowerShell at TechEd

Stop by the Scripting Guys booth in the Connect Zone area at Microsoft TechEd North America 2012 to learn more about PowerShell: Here’s The Scripting Guy (Ed Wilson) at the Scripting Guys booth yesterday while he was talking about my guest blog on the Hey, Scripting Guys! Blog (displayed on the monitor): Also stop by the Windows Server 2012 Server Manager & PowerShell booth in the Technical Learning Center area:

PowerShell 3.0 Hands-On Labs at TechEd 2012

Thinking about learning the new features of PowerShell 3.0 at Microsoft TechEd North America 2012? If you’re planning to get some hands on experience using the hands on labs, don’t waste your time. I attempted to go through the WSV11-HOL “What’s New in Windows PowerShell 3.0 " this morning: Only to find out the resolution (screen size) on the virtual machine is set too high to view the content: I also attempted the WSV12-HOL “Introduction to Windows PowerShell Fundamentals 3.

Microsoft TechEd 2012 BackPack (Bag) Choices

Here’s what the inside of the three backpack choices look like at Microsoft TechEd North America 2012. I thought I was going to choose the silver bag since the pictures seemed to have a silver Buck Rogers look, but I ended up going with the blue urban camo bag since the silver one has a hideous glow in the dark neon green color on the inside of it: Here’s what the outside of the backpacks look like.

Microsoft TechEd 2012 Transportation (Bus) Schedule

Here’s the Microsoft TechEd North America 2012 Transportation (Bus) Schedule as posted in the lobby of the hotel I’m staying at. Click on the image for a zoomed-in view: Here’s a challenge for anyone who views this. There’s a small amount of the lobby of the hotel shown in the image above. Can anyone guess what hotel I’m staying at? Here’s where you can download a PDF of this schedule.

Managing Symantec Backup Exec 2012 with PowerShell

On Saturday of this past weekend, I had my first guest blog titled Managing Symantec Backup Exec 2012 with PowerShell published on the Hey, Scripting Guy! Blog which is the #1 blog on Microsoft TechNet and read by literally millions of people each year. Be sure to check out the guest blog using the link above! µ

Tips for Microsoft TechEd First Time Attendees

Tip #1: Bring Government Issued Photo ID and Printed TechEd Final Details Email Don’t forget to bring some form of government-issued photo identification along with your TechEd and Hotel registration confirmations. You should have received an email titled “Microsoft TechEd North America 2012: Final Details” sometime around May 29th that includes a barcode that will speed up your registration process. TechEd is sold out this year so don’t wait until the last minute to go through the onsite registration process.

Use PowerShell to Audit Logon Authentication Type

Want to know what type of authentication mechanism is being used when users log onto your servers? This script pulls the information from the event logs to determine how users are being authenticated. It uses Get-Winevent with the -FilterXPath parameter. That parameter and what the logon type numeric codes translate to are a couple of things that I haven’t seen much documentation on. The script sorts by server name in ascending order and then by the time in descending order.

Adding PowerShell Snap-in’s and Locating Added Cmdlets

Want to make the SharePoint 2010 cmdlets available for use from the PowerShell ISE? Some products such as SharePoint 2010 provide their application specific PowerShell cmdlets via a PowerShell snap-in instead of a PowerShell module. The following commands are being run from the PowerShell ISE on a SharePoint 2010 web front-end server. To view the snap-ins that are available to add, run the following: Get-PSSnapin -Registered The SharePoint 2010 snap-in is installed on the machine, but its cmdlets are not yet available for use.

Using PowerShell to Find Expiring SSL Certificates & the Websites they’re Associated with

Have you recently received a notification about an expiring SSL certificate and don’t remember where all it’s used at? It’s generally not an issue to figure this out with normal certificates which are issued for a single name, but if it’s a wildcard certificate, it could be used on lots of different websites within your organization. The following PowerShell script retrieves all of the SSL certificate’s thumbprints and their expiration dates on an individual server that has IIS installed (This has only been tested on Windows Server 2008 R2).

Using the Quest Active Directory PowerShell Snapin to Search For & Set Attributes

I want to make sure that all users in a specific OU in my mikefrobbins.com Active Directory domain have the “Deny this user permissions to log on to Remote Desktop Session Host server” option set (checked): Download the Quest Active Directory PowerShell Snapin (free). The PowerShell command shown below searches this specific OU in my Active Directory domain for users where this attribute is not equal to false. The default setting is blank (allowed) as shown with the Gill Bates user below.

Rename an IIS Web Application with PowerShell

Want to rename an IIS Web Application on a Windows 2008 R2 server? It’s not possible from the GUI, but it’s simple to accomplish using PowerShell. First, let’s create a web application in an existing website and then verify it exists: Import-Module WebAdministration New-Item -ItemType Directory -Path d:\iis\robbinsapps New-WebApplication -Name RobbinsApps -Site MikeFRobbins -PhysicalPath d:\iis\robbinsapps -ApplicationPool "ASP.NET v4.0" Get-ChildItem iis:\sites\mikefrobbins Here it is in the GUI: Rename the web application using PowerShell and then verify it was renamed:

Create a New IIS Website with PowerShell

On a Windows Server 2008 R2 machine, IIS has already been installed and you want to create an additional website. If necessary, an additional IP Address has been added to the server also. Use the New-Website PowerShell cmdlet to accomplish this task: Import-Module WebAdministration New-Item -type directory -path d:\iis\mikefrobbins New-Website -Name "mikefrobbins" -Port 80 -IPAddress "192.168.1.222" -PhysicalPath d:\iis\mikefrobbins -ApplicationPool "ASP.NET v4.0" You can get a list of websites running on the server by using the Get-Website cmdlet or by running Get-ChildItem on the IIS PSDrive:

Use PowerShell to Check the Firmware Version on an EqualLogic Storage Area Network

I received an email recently stating that I hadn’t downloaded the most recent version of firmware for multiple EqualLogic Storage Area Networks that I support. What’s the easiest way to check what firmware version an EqualLogic SAN is running? PowerShell of Course! You’ll need the EqlPSTools PowerShell Module which is part of the EqualLogic Host Integration Tools (HIT) kit for Microsoft that can be downloaded from the EqualLogic support site. Once this module has been installed, you’ll be able to check the firmware version on your EqualLogic SAN using the following PowerShell script:

Symantec Backup Exec 2012 Adds PowerShell Support!

The latest version of Backup Exec, version 2012 adds support for PowerShell. When Backup Exec 2012 is installed, it adds a PowerShell module named “BEMCLI”: You’ll need the .NET Framework 3.5.1 installed to be able to import this module: I’m guessing this .NET Framework 3.5.1 issue is an oversight since the typical installation installs the .NET Framework 4.0, but doesn’t enable 3.5.1: Enable the NET-Framework-Core Windows Feature. You’ll have to import the server manager module (Import-Module ServerManager) first if adding it through PowerShell:

Is PowerShell 2.0 Installed by Default on Windows Server 2008 R2?

As with most things in IT, the answer is that it depends. It depends on whether or not the server was installed with the Full Installation or with the Server Core Installation. It also depends on what your definition of installed is. If the server was installed with the Full Installation (GUI) then PowerShell is installed (enabled) by default, but if it was installed using the Server Core Installation (no GUI) then PowerShell is not installed (not enabled) by default.

New PowerShell Cmdlets added with the EqualLogic HIT Kit version 4.0.0

The EqualLogic Host Integration Tool kit for Microsoft version 4.0.0 adds 12 additional PowerShell cmdlets to the 55 that existed in version 3.5.1 for a total of 67 cmdlets. The release notes state that firmware version 4.2.0 or later is required for the HIT kit v4.0.0 PowerShell tools. The syntax of several of the existing cmdlets also changed which appears to be mostly the addition of new parameters. See the release notes which are included as part of the new HIT kit that can be downloaded from the EqualLogic support site for details about the changes to existing cmdlets.

Set-WSManQuickConfig Error When Running PowerShell Enable-PSRemoting Cmdlet on Web Server

I recently ran into an issue when trying to access one of my Web Servers with PowerShell remoting. Here’s a simple test to show the error: My first thought was that PowerShell remoting wasn’t enabled on the target computer. So let’s try to run this without remoting: No luck with using that route either. I headed over to the web server and ran the Enable-PSRemoting Cmdlet and received another error:

Interesting How People are Claiming to Have Same Beginner 1 Solution as the Expert Solution but Still Did Not Get 5 Stars

This past weekend I posted a blog about Beginner Event #9 of the 2012 PowerShell Scripting Games and I received a comment on it from @ruddawg26. I took a look at his profile and tweets. I found a tweet that was tweeted by him Interesting how people are claiming to have same beginner 1 solution as the expert solution but still did not get 5 stars #2012SG so I decided to investigate further which is how this blog came to be.

Performance Counters – 2012 PowerShell Scripting Games Beginner Event #10

The details of the event scenario and the design points for Beginner Event #10 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Gather all of the counter information for the processor counter set. Take three separate readings at five second intervals. This information should be appended to a single text file named servername_ProcessorCounters.txt in the Documents special folder. You’ll lose points for complexity. Use native PowerShell commands where possible.

Search Event Log – 2012 PowerShell Scripting Games Beginner Event #9

The details of the event scenario and the design points for Beginner Event #9 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Find Veto Shutdown Events in the Application Event Log. A screenshot was provided that contains EventID 10001 and Winsrv as the source. Write a one liner to display the date of occurrence and the application name. Your command should be efficient. Complexity will cost you points.

Determine Hardware Type – 2012 PowerShell Scripting Games Beginner Event #8

The details of the event scenario and the design points for Beginner Event #8 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Write a script to determine if a computer is a laptop or a desktop from a hardware prospective and display the output on the console. If this requires admin rights, you should detect if it is running as an admin or standard user.

Enabled Logs with Data – 2012 PowerShell Scripting Games Beginner Event #7

The details of the event scenario and the design points for Beginner Event #7 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Display a list of enabled logs that contain data. Do not display errors. Include hidden logs. Display the complete log name and number of entries. Sort by the logs with the most entries in them. My research on this one lead me to the Use PowerShell to Query All Event Logs for Recent Events blog article on the Hey, Scripting Guy!

Working with WMI – 2012 PowerShell Scripting Games Beginner Event #6

The details of the event scenario and the design points for Beginner Event #6 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Write a PowerShell script to determine the uptime of servers by using the WMI class WMI32_OperatingSystem. The script should display the server name, how many days, hours, and minutes the server has been up. As usual, I started out by running Get-Help Get-WMIObject to determine what the available parameters were for this cmdlet.

Finding Application Errors – 2012 PowerShell Scripting Games Beginner Event 5

The details of the event scenario and the design points for Beginner Event #5 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Your manager has task you with producing a report of applications that are causing errors on your servers. This report should display the source and number of errors from the application log. How can I find out what PowerShell cmdlets are available to query the application event log?

Just Passing Thru – 2012 PowerShell Scripting Games Beginner Event 4

The details of the event scenario and the design points for Beginner Event #4 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. The key to this one is figuring out how to format the output as shown in the screen shot in the event scenario which is similar to the one in the image below: The PowerShell Down Under guys posted some great prep videos leading up to the beginning of the scripting games and one of them titled Scripting Games 2012 - Working with Folders gives you a head start on solving this one.

Toughest Event Yet – 2012 PowerShell Scripting Games Beginner Event #3

The details of the event scenario and the design points for Beginner Event #3 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. This was the toughest event out of the first three for me. I spent a lot of time researching how to check permissions because part of the first design point stated: “If you do not have permission off the root, create the nested folders where you have permissions”.

Get-Method | My-Madness | 2012 PowerShell Scripting Games Beginner Event #2

The details of the event scenario and the design points for Beginner Event #2 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Listed below are my notes about the requirements and design points: Find all services that are running and can be stopped. The command must work against remote computers. Use the simplest command that will work. You do not need to write a script.

My Approach to the 2012 PowerShell Scripting Games Beginner Event #1

The details of the event scenario and the design points for Beginner Event #1 of the 2012 PowerShell Scripting Games can be found on the Hey, Scripting Guys! Blog. Listed below are my notes about the requirements and design points: Computers run Windows 7 and servers run Windows 2008 R2. They’re all in one domain. PowerShell remoting is enabled on all computers (both servers and desktops). Use PowerShell to retrieve the top ten processes based on the memory working set.

Importing PowerShell Modules and Locating Added Cmdlets

Want to add a feature to a Windows Server 2008 R2 machine using PowerShell? That functionality is part of the ServerManager PowerShell Module that’s install by default on 2008 R2. The module has to be imported for it’s cmdlets to be made available since it’s not loaded by default when you launch PowerShell. To view the Modules that are available to be imported, run Get-Module -ListAvailable The ServerManager module has to be imported so that it’s commands are made available to PowerShell.

Game On! The 2012 PowerShell Scripting Games

Since this is my first year entering the PowerShell Scripting Games, I’m only submitting scripts for the beginner events but I’m also taking a look at the advanced ones to get an idea of what kind of knowledge is needed for them. It’s not too late to join in on the fun. Make sure you read the requirements of each event carefully, create your script, test it, and think about it for a while before submitting it.

How Do I Get-Started With PowerShell?

Commands in PowerShell are called cmdlets (pronounced “command lets”) and they are in the form of singular verb-noun commands like Get-Alias (not Get-Aliases). In my opinion, there are three cmdlets that are the key to figuring out how to use PowerShell and finding help when you need it. These cmdlets are: Get-Help (help) Get-Command (gcm) Get-Member (gm) Get-Help or Help for short. Help isn’t actually an alias, but it works exactly the same way if your using the PowerShell ISE.

Using PowerShell to Ace the Scripting & Regular Expression Interview Question

Last week I saw a tweet that referenced a couple of interesting articles on interview questions for programmers. I’m no programmer, but one of them (Steve Yegge’s The Five Essential Phone-Screen Questions) had an interesting question about identifying which of 50,000 web pages had phone numbers in them. You have to identify all of the web pages with phone numbers hard coded in them. All of the web pages are HTML files in a directory tree under a folder named website.

Confusion on PowerShell Parameterized Functions

I’ve run into an issue with PowerShell functions that I don’t understand. I guess my confusion is most of the examples I’ve found online and in books don’t work the way the authors explained (at least not for me). The problem is when I define a parameter inside a function, that parameter is not accessible when running the script. function Get-CPUInfo { Param ($ComputerName) Get-WmiObject -Class Win32_Processor -ComputerName $ComputerName | Select-Object SystemName, CurrentClockSpeed, Manufacturer | Format-Table -AutoSize } Get-CPUInfo When I move the parameter outside of the function, it’s accessible and it works without issue.

Where Do I Find This Thing Called PowerShell?

If you’re running Windows 7, you already have PowerShell 2.0 installed. It’s located under “All Programs > Accessories > Windows PowerShell”. I’m running a 64bit version of Windows 7 so I have both 64bit and 32bit (x86) links in my start menu. I prefer the PowerShell ISE (Integrated Scripting Environment) as apposed to the PowerShell Console. I use the 64bit version and have never run into an issue where I needed to use the 32bit (x86) versions.

Get-WmiObject : The RPC Server is Unavailable. (Exception from HRESULT: 0x800706BA)

This week while working with some PowerShell scripts that retrieve WMI information from remote servers, I ran into an issue where I was able to return results from Windows 2008 R2 servers without issue but was unable to return results from Windows 2008 (non-R2) servers even though they had PowerShell 2.0 installed and as far as I could tell they were configured exactly the same as the Windows 2008 R2 servers.

Your Search Cannot Be Completed Because This Site Is Not Assigned To An Indexer.

Your attempting to search a SharePoint 2010 Site (Foundation Edition) and you receive the following error message “Your search cannot be completed because this site is not assigned to an indexer.” Search has never been configured for this SharePoint farm so we’ll be configuring it from the ground up. First you’ll need two service accounts, one for the search service to run as and one for the actual crawling. Todd Klindt has a great blog on service accounts that I use for reference.

Installation of SQL Server Features from the Command Line

I’m installing a line of business application that requires the SQL Server Management Studio and Client Tools Connectivity be installed as a prerequisite. I want to script this instead of having to manually click through the GUI for the installation since this will be installed on several servers. I’ve mounted the SQL Server 2008 R2 ISO on “Z” drive. The following command will produce the desired results: Setup.exe /qs /ACTION=Install /FEATURES=SSMS,CONN /IACCEPTSQLSERVERLICENSETERMS At first, I thought that the CONN parameter was incorrect because it also added the SQL Client Connectivity SDK, but upon further review the GUI installation does the same thing:

Set EqualLogic PS Series SAN Volume ACL’s using PowerShell

Query and return the current Access Control List (ACL) for an EqualLogic PS Series SAN volume named “mikefrobbins” using PowerShell: $GrpAddr = "10.0.0.200" $VolName = "mikefrobbins" Import-Module "c:\program files\EqualLogic\bin\EqlPSTools.dll" Connect-EqlGroup -GroupAddress $GrpAddr -Credential (Get-Credential) Get-EqlVolumeACL -VolumeName $VolName Disconnect-EqlGroup -GroupAddress $GrpAddr You can see the same information using the GUI: Remove the current ACL’s using the following PowerShell command: $GrpAddr = "10.0.0.200" $VolName = "mikefrobbins" Import-Module "c:\program files\EqualLogic\bin\EqlPSTools.dll" Connect-EqlGroup -GroupAddress $GrpAddr -Credential (Get-Credential) Remove-EqlVolumeACL -VolumeName $VolName Disconnect-EqlGroup -GroupAddress $GrpAddr Once again, you can see the same information using the GUI:

Unable to Grant Domain Local Groups Full Access Permission to a Exchange 2010 Mailbox using the GUI

John Doe is a user in your Active Directory environment (Windows Server 2008 R2 Forest Function Level) with a mailbox on the email server (Exchange Server 2010 with SP2): You want to grant a domain local group named “Test Group” the full access permission to John Doe’s mailbox: You attempt to grant this permission by selecting “Manage Full Access Permission” from the Exchange 2010 Management Console: When you click add and search for the group, it doesn’t appear:

Oh Where, Oh Where Have My Group Policy Options Gone?

You are unable to find specific GPO options such as “Compatibility View” settings for Internet Explorer. One of the first things to look at is: Where are the policy definitions being retrieved from? The default for an Active Directory environment is from the local machine as shown in the image below: If you’re editing the GPO on a domain controller and have multiple domain controllers that are running different operating system versions, the available options will vary from machine to machine.

Open a SharePoint Document Library with Windows Explorer

To resolve this problem, enable the “Desktop Experience” feature on the machine you are attempting to open the document library from (the client machine): You can also enable the “Desktop Experience” feature using PowerShell: Import-Module ServerManager Add-WindowsFeature Desktop-Experience A restart is required once this feature is enabled. µ

Add an Additional Web Front-end Server to an Existing SharePoint 2010 Farm using PowerShell

You’ve followed the instructions in my other three blogs and built a SharePoint 2010 farm (not a stand-alone installation) with one or more web front-end servers. Per one of the notes in a TechNet article I found: “As a best practice, we recommend the operating system on the new server should be at the same service pack level and have the same security updates and other hotfixes as the existing farm servers.

Reset the SharePoint 2010 Passphrase with PowerShell

You’re attempting to add an additional web front-end server to your SharePoint 2010 farm and find out the passphrase you’ve documented is incorrect or it isn’t documented. Resetting the passphrase is a fairly simple process. Open PowerShell and execute the following script. Enter the new passphrase when prompted: Add-PSSnapin Microsoft.SharePoint.PowerShell $Passphrase = Read-Host -assecurestring "SP PassPhrase" Set-SPPassPhrase -PassPhrase $Passphrase –Confirm Most other blogs on this subject use the code shown in the image below, but why would you want the password to be shown in clear text when it’s typed into the textbox?

Installing SQL Server 2012 RC0 on Server Core

Last week, I published a blog on Installing SQL Server Denali CTP3 on Server Core and then SQL Server 2012 RC0 was made available for download so I thought I’d write an updated blog since the issues I ran into with the installation seem to be resolved. One of the new features in SQL Server 2012 is official support from Microsoft for installation on Server Core. There’s an MSDN article on Install SQL Server 2012 on Server Core and another MSDN article on Install SQL Server 2012 from the Command Prompt that has a detailed list of all the different parameters.

Installing SQL Server Denali CTP3 on Server Core

One of the new features in SQL Server Denali CTP3 is support for installation on Server Core. There’s an MSDN article on Installing SQL Server Denali on Server Core and another MSDN article on Install SQL Server Denali from the Command Prompt that has a detailed list of all the different parameters. Based on the first article, the setup routine should enable and/or install all of the necessary prerequisites, but that simply isn’t the case from what I found.

Check the Time on Remote Machines with PowerShell

I ran into an issue lately where the domain controller that hosts the PDC emulator FSMO role for the forest root domain became unavailable and the time for several machines in the domain was far enough off to start causing kerberos related security problems. Here’s a simply Powershell script to query the time on remote machines via WMI. You could use Invoke-Command with Get-Date, but that takes too long compared to just using WMI.

Unable to Print Incoming Faxes on FaxPress

I recently received a call from a customer who has an older Castelle FaxPress 5000. They reported that their incoming faxes were no longer printing automatically even though they were receiving faxes in the “Unaddressed Faxes” queue in Faxmain. To check the settings for automatically printing incoming faxes, open Faxmain, expand the tree, right click on the “Unaddressed Faxes” folder and select properties: Verify the “Print Incoming Fax” checkbox is checked on the “Incoming Faxes” tab:

ASUS Eee PC 1101HAB Netbook RAM & Hard Drive Upgrade

Read this entire blog before beginning this process since there is an issue with SSD hard drives and Windows 7 in this particular netbook model. I will also warn you that this is one of the most difficult machines to replace the hard drive in that I’ve seen. First, remove the battery and hold down the power button for 30 seconds. Memory Upgrade Turn the computer upside down. Remove the single screw from the memory cover:

Initial Configuration of a Dell PowerConnect Switch

You have a new out of the box Dell PowerConnect Switch and need to assign it an IP address so you can remotely access and manage it. Connect a 9 pin serial (female to female) cable to the switch. You’ll probably need a USB to Serial Port adapter on the computer end since most computers (especially laptops) no longer have serial ports. Open up Hyper Terminal or another terminal emulation program.

Terminal Server Related PowerShell Scripts

Thought I would post a couple of PowerShell scripts that I’ve recently written. Both of these scripts were written specifically for terminal servers but they can be modified as needed. The first one finds what terminal servers a user is logged into. It retrieves a list of terminal server names from the specified OU. I started out by using the Get-TSServers cmdlet for the list of servers, but that cmdlet takes a while and you have more control by just using the Get-ADComputer cmdlet since your terminal servers are more than likely in their own OU anyway.

Find AD User Account Lockout Events with PowerShell

A few weeks ago a user contacted me and stated they were constantly being locked out throughout the day. This could have been caused by a number of things from someone else trying to log in as them to being logged in somewhere else, changing their password and the session with the old password still being active. I ran a search of the security event log on the domain controllers and found the name of the machine that the user was being locked out from.

Create AD Group and Copy a Group’s Members with PowerShell

This week, I was asked if I could export a list of users who were members of a specific group in Active Directory. My Question: What’s this list for? Answer: We’re working on a project that requires us to create a new security group in Active Directory and we’re going to add all the users on the list to the new group. I determined that this new group really was necessary.

Restore a Replaced Document in SharePoint Server 2007

A few weeks ago I had someone ask me about restoring a single Excel spreadsheet in Microsoft Office SharePoint Server 2007 (MOSS). The spreadsheet had been overwritten by uploading another one in its place with the same file name. Versioning was not turned on in this document library. The spreadsheet that needed to be restored was not in the user’s or admin’s recycle bin. I guess that’s because it wasn’t actually deleted.

Installation of the Windows 8 Developer Preview

The Windows 8 Developer Preview was publicly released this past Tuesday evening via the new Windows Dev Center. I actually thought I was going to miss out on the opportunity to try out this preview version since I’m not currently a MSDN subscriber. I was happy to learn that it was made available for anyone to download. Since this is a preview version, I decided to load it as a virtual machine on a Hyper-V server.

Resolving SharePoint 2010 PDF Issues with PowerShell

PDF’s that have been uploaded to your SharePoint 2010 document libraries do not show the correct icon and only give you the option of saving instead of opening them: The following PowerShell script downloads a 17×17 GIF image from Adobe.com named pdficon_small.gif, places it in the images folder under the 14 hive, associates it in the DOCICON.XML file, sets Browser File Handling to Permissive, and then runs IISReset: $14 = "C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14" $src = "https://www.

Dell EqualLogic PS4000 – Creating a Volume with PowerShell

Download the EqualLogic Host Integration Toolkit (HIT Kit) for Microsoft from the EqualLogic support site. Install the PowerShell Tools portion of the HIT Kit on the computer you want to manage the SAN from. For a PS4000, this computer doesn’t need access to the iSCSI network as long as it has connectivity to the management network. The following PowerShell script creates a 36GB thin provisioned volume named mikefrobbins with a snapshot reserve of 100%, sets a description for the volume, allows two specific IP addresses to access the volume and its snapshots, sets up a 1am snapshot schedule that takes place once per day and attempts to keep 7 snapshots as long as the total size of the snapshots doesn’t exceed the snapshot reserved space.

The Easy Way to Create a Bootable Windows 7 USB Flash Drive

I recently loaded Windows 7 on my netbook computer and ran across a tool named Windows 7 USB/DVD Download Tool which makes creating a Windows 7 bootable USB flash drive much easier. Download and install this tool. Open the program and select the ISO you want to copy to your USB flash drive. Select “USB device”: Select the USB flash drive you want to copy the Windows 7 installation media to.

Restoring a Microsoft SQL Server Database

This blog article is a scenario that I sent a coworker a while back about recovering a SQL Server database up to the point in time where a catastrophic hard disk drive failure occurs for the hard drive containing a SQL Server database. The transaction log for this database is on a separate physical disk and is still accessible. I added the Northwind database to SQL Express on my machine, changed the recovery model to full, and then backed up the database and transaction log:

Set SharePoint 2010 Outgoing E-Mail Settings with PowerShell

Configure the outgoing email settings in a SharePoint 2010 Farm with PowerShell. Launch the PowerShell ISE. Import the SharePoint PowerShell Snap-in, modify the script below using your specific email server settings and then run the script. Add-PSSnapin Microsoft.SharePoint.PowerShell $SMTPSvr = 'mail.mikefrobbins.com' $FromAddr = 'noreply@mikefrobbins.com' $ReplyAddr = 'noreply@mikefrobbins.com' $Charset = 65001 $CAWebApp = Get-SPWebApplication -IncludeCentralAdministration | Where { $_.IsAdministrationWebApplication } $CAWebApp.UpdateMailSettings($SMTPSvr, $FromAddr, $ReplyAddr, $Charset) The outgoing email settings are now configured.

Slipstream SP1 into Microsoft SharePoint Foundation 2010

This blog article will guide you through the process of slipstreaming SP1 into Microsoft SharePoint Foundation 2010. The process for the non-foundation edition is identical with the exception of the file names and the actual service pack file. You’ve downloaded SharePoint Foundation 2010 and SP1 for that specific version to D:tmp. You’ve created a folder (D:\sp2010) to house the installation files once they’re slipstreamed. Extract the SharePoint installation files into the D:\sp2010 folder::

Microsoft SharePoint Foundation 2010 Installation – Part 3

This blog is a continuation from last weeks blog (Part 2). We’ll jump right in where we left off. Verify you are logged into the server that you want to install SharePoint on as the sp_Name_Install account. Right click the PowerShell ISE and select “Run as administrator”: Load the SharePoint PowerShell Snap-in: Add-PSSnapin Microsoft.SharePoint.PowerShell You will receive “The local farm is not accessible. Cmdlets with FeatureDependencyId are not registered.” This is normal since we have not configured the farm yet.

Microsoft SharePoint Foundation 2010 Installation – Part 2

This blog is a continuation from last weeks blog (Part 1). We’ll jump right in where we left off. Verify you are logged into the server that you want to install SharePoint on as the sp_Name_Install account. Run the SharePoint executable (SharePointFoundation.exe) that you previously downloaded. Select “Install software prerequisites”: With SharePoint 2010, there’s no need to manually install any of the prerequisites as in previous versions of SharePoint. It installs all of them for you:

Microsoft SharePoint Foundation 2010 Installation – Part 1

You’re ready to introduce SharePoint 2010 into your [SMB])https://en.wikipedia.org/wiki/Small_and_medium_businesses) and you’ve chosen to install the free with Windows Server version called “Foundation”. Details about this version can be found on the SharePoint Foundation 2010 Production Information webpage. You’ll need a minimum of two servers, virtual or physical with the specifications listed below to get started. While it is possible to run SharePoint 2010 on a single server, it’s definitely not recommended for a production environment.

Create an Active Directory User Account with PowerShell

I’m in the process of installing SQL Denali and need a couple of users accounts created. If you are creating the Active Directory user on a machine other than a domain controller, you’ll need to install the Active Directory module for Windows PowerShell. Then import the Active Directory module. Import-Module ServerManager Add-WindowsFeature RSAT-AD-PowerShell Import-Module ActiveDirectory To see the syntax and available options for creating an Active Directory user using PowerShell, type “Get-Help New-ADUser” inside the PowerShell console.

Install the PowerShell ISE & Enable PowerShell Scripts

PowerShell 2.0 is installed by default on Windows 7 and Windows Server 2008 R2. The PowerShell ISE (Integrated Scripting Environment) is installed by default on Windows 7, but not Windows Server 2008 R2. You can use the following information to install the ISE on your 2008 R2 server (as long as it’s running the full GUI and not the Core installation). Launch PowerShell and execute the following: Import-Module ServerManager Add-WindowsFeature PowerShell-ISE If you attempted to run this on the Core (no GUI) installation of Windows Server 2008 R2, you would receive the following error:

EqualLogic PS Series SAN Password Recovery

Problem: You’re unable to login to your EqualLogic PS Series Storage Area Network (SAN) to perform administrative functions. When you attempt to login, you receive a login exception message stating “Invalid username or password”. Solution: The grpadmin account password can be reset by connecting a computer to the serial port of the active controller on your EqualLogic SAN. You’ll need one of the serial cables that shipped with your SAN which is a standard 9 pin female to female serial cable.

Enabling Dynamic Memory for a Guest VM on Hyper-V

You’ve loaded SP1 on your Windows Server 2008 R2 Hyper-V virtualization host server and you’re ready to begin using Dynamic Memory for your virtualization guest machines (VM’s). Listed below is the minimum amount of changes required for your virtualization guest machines (VM’s) to be able to use dynamic memory: Set the VM to use Dynamic Memory by specifying a minimum and maximum amount of memory. The VM will need to be shutdown in order to change this setting and the settings will only show up if the computer running Hyper-V manager has SP1 installed.

Number of Supported Virtual CPU’s for a Guest on Hyper-V

Question: How many virtual processors (virtual CPU’s) are officially supported by Microsoft for a guest virtual machine (VM) running on Hyper-V? Answer: You may be thinking the answer to this question is four since that is the number you can assign to any guest VM, but the answer like many others in IT is that it depends. It depends on what guest operating system you’re running. Windows Server 2003, Windows Vista, and Windows XP SP3 all officially support a maximum of two virtualized processors when installed as a guest VM running on Hyper-V.

Unable to Configure Email Server Settings in Trend WFBS 7.0

Problem: When attempting to configure email server specific settings in Trend Micro Worry Free Business Security – Advanced 7.0, you receive the error: “Internet Explorer cannot display the webpage”: When you hover over an option such as “Disable” in the Anti-spam section, you notice a URL that points to your email server. By default it points to port 16372 on the email server. This is the first clue that gives you an idea that this is potentially a problem with the firewall on the email server:

HP Digital Sending Software Error when using IPv6

I recently ran into an issue where one of my customers HP Digital Senders would no longer resolve email addresses automatically to Active Directory using the HP Digital Sending Software version 4.91. It generated the error: “The operation failed. Please verify your configuration and try again. (LDAP error ServerDown occurred.)”: It also generated the error: “The operation failed. Please verify your configuration and try again. (AUTH_LDAP_SERVER_NOT_AVAILABLE)": While many different problems may cause these same errors, this particular problem was due to the DSS server communicating via IPv6 with the domain controller specified in the addressing portion of the configuration.

Configure the Page File Size on Windows 2008 Server Core

I recently ran into an issue where I couldn’t start any additional virtual machines on a Hyper-V server that was running Windows Server 2008 R2 Enterprise Edition - Core Installation (no GUI). After a little research, I determined that the operating system had created a pagefile of over 100 gigabytes in size which was using up the majority of the DAS in the server. The server has 96GB of RAM which is the reason why the operating system automatically configured such a large pagefile.

Running the Dell System E-Support Tool (DSET) on Server Core

There are multiple reasons why you might want to run the Dell System E-Support Tool (DSET) on your Dell PowerEdge server. It could be because Dell Support has requested it or you’re trying to diagnose a problem or you simply want to know what version of BIOS your server is running without having to reboot it. This tool is especially useful when it comes to Windows Server 2008 R2 core installation since many other utilities will not run on server core.

PowerShell Script to Return a List of Mailbox Size for All Users

On several occasions, I’ve been asked to provide a report of mailbox sizes and number of items in a mailbox to a few of my customers who are running either Exchange Server 2007 or 2010. Like most of my blogs, this blog is as much documentation for myself as anything else. That way when I need to provide another one of these reports again in a few months, I’m not trying to figure out how I previously accomplished the task.

Enabling Jumbo Frames for iSCSI on Server Core

I recommend following the instructions in my Rename a Network Interface from the Command Line so you can easily distinguish the difference in the network interfaces. Once the network interfaces are renamed, they should look similar to the ones in this image: If you attempt to ping your SAN at this point with a 8972 byte ping (9000 bytes minus a 20 byte IP header and a 8 byte ICMP header), you’ll receive a message stating “Packet needs to be fragmented but DF set.

MultiPath I/O on Server Core with the EqualLogic HIT Kit

I’ve written a few other blogs about iSCSI and Multipath I/O on Windows Servers, but this one focuses on installing the EqualLogic Host Integration Tool (HIT) Kit on Windows Server 2008 R2 Core (no GUI). If you are using an EqualLogic SAN, I recommend installing the HIT kit before doing any of the iSCSI or Multipath I/O configuration. It will make your life a lot easier. It’s also not a problem to install the HIT kit after you’ve done some or all of the configuration, just keep in mind there will be a few dialog boxes in this blog that you won’t see such as the HIT kit wanting to install the Multipath I/O feature.

Rename a Network Interface from the Command Line

While building a Hyper-V server this week, I decided to rename the network interfaces to something that would make identifying the iSCSI connections a little easier. Since the server was installed with only the core (no GUI) installation of Windows Server 2008 R2, the process had to be performed from the command line. The network interface is also commonly referred to by other names such as network adapter or network connection.

Filter Results by Piping Output to the Find Command

Piping the output of a command line utility to the find command is a way to easily narrow down the results that are returned. Here’s an example of piping the output of the netstat command to find only the ports that your server is listening on: netstat -an -p TCP | find /I "listening" You can pipe the output multiple times to narrow down your search results: The find command can also be used to search text files:

Remote Desktop Licensing in Windows Server 2008 R2

This blog article will guide you through the steps of setting up Remote Desktop Licensing or Terminal Services Licensing as it’s known in previous versions of Windows Server. You’ve decided to move from Windows 2003 R2 to 2008 R2 domain controllers and you want to run your terminal services licensing on the new domain controllers. You can run the licensing for all your terminal servers operating with Windows 2000 Server and newer Windows Server versions on Windows Server 2008 R2.

Typical Installation of Exchange Server 2010

This blog will walk you through the steps of a typical Exchange Server 2010 Installation. Be sure to follow the instructions in my Installation of Exchange Server 2010 Prerequisites blog. By having completed the steps in that previous blog article, you can jump right into Step 3: Select the appropriate option. In the example below, I chose “Install only languages from the DVD”: Click on the link for Step 4:

Time Synchronization in an Active Directory Environment

In an Active Directory environment the default time source is the domain controller in your forest root domain that is running the PDC emulator FSMO role. Keep in mind that the PDC emulator FSMO role is a domain level FSMO role so each domain will have one, but each domain’s PDC emulator will receive its time from the forest root’s PDC emulator. The following procedure will walk you through the steps of configuring the forest root’s PDC emulator to receive its time updates from an Internet time server.

Spam Filtering for Microsoft Exchange Server

ORF Enterprise Edition is my spam filter of choice and has been through several generations of Exchange Server versions. The product is licensed per server so regardless of mailboxes or users you only need one license per Exchange Server. The initial year is $239 and each year after that is $99 per year. I haven’t seen any other spam filtering product for an Exchange Server that offers a better price to performance ratio.

Installation of Exchange Server 2010 Prerequisites

It has been about six months since I transitioned one of my customers from Exchange Server 2007 to 2010 and I’ve found myself saying “How did I do that?” so I decided to write a blog about the process this time since I’m transitioning another customer. In the following example, a server named email which is running the Windows Server 2008 R2 operating system has been added to the mikefrobbins.com Active Directory domain and all of the available windows updates have already been installed.

Managed Service Accounts

Managed Service Accounts seem to be the end all and fix all for those services such as Exchange or SQL that we have all at some point either set to run as local system, an administrator account, or at best a domain user account that has been setup with the principal of least privilege. Using an account such as local system grants more rights than necessary and the service ends up running as a local administrator equivalent.

Memory Upgrades Beyond Manufacturer’s Recommendations

We’ve probably all heard to check with your computer system or motherboard manufacturer to find out what the maximum installable amount of memory is for your computer. I’m guessing that’s what most of the third party memory companies do also since who in their right mind would go against the manufacturer’s recommendations? I suggest also checking with the motherboard chipset manufacturer. I own a Dell XPS 410 that’s used as a test machine.

Increase the size of a volume on an EqualLogic PS4000XV SAN

You have a Windows 2008 R2 server that is nearly out of disk space on its ‘D’ drive. The ‘D’ drive is a volume on an EqualLogic PS4000XV Storage Area Network. This is a production server and the change needs to be done immediately in the middle of the day without service interruption. Whenever possible, I prefer to make changes like this outside of production hours or as scheduled downtime if you operate in a 24/7 environment since there is a chance that something could go wrong.

Updating the Firmware on an EqualLogic PS4000XV SAN

This blog will walk you through the steps of updating the firmware on an EqualLogic PS4000XV SAN (Storage Area Network) from version 4.3.0 to version 5.0.2. Plan the Update This process requires that the SAN be restarted so I recommend scheduling it outside of production hours or as scheduled downtime if you work in a 24/7 environment. I also recommend gracefully shutting down any servers that have data on the SAN since you would otherwise be ripping the drives out from underneath those servers.

SharePoint Saturday New Orleans 2011

Over the past year or so, I’ve attended several SharePoint Saturday technology events to include Birmingham in 2009, New Orleans, Atlanta, and Huntsville in 2010. These technology events are a great way to expand your knowledge on a particular aspect of SharePoint, network with other technology professionals who work with SharePoint on a daily basis, and as a nerd, a way to have a good time in general. Registration opened up this week for the 2011 SharePoint Saturday in New Orleans which will be held on February 26, 2011.

When was an Active Directory Group Created or Modified?

This week I needed to figure out when a group was created in one of the Active Directory environments that I provide support for. I looked at the group using “Active Directory Users and Computers” and didn’t see anything that would tell me when it was created. I did a quick Google search and found a way to accomplish this for a similar item (a user object) using VBScript. The example for a user object that I found was on a Hey, Scripting Guy!

Memory (RAM) Upgrade for your Personal Computer (PC)

While RAM (Random Access Memory) seems to be a simple subject, I can tell you from experience, if you want problems that are difficult to troubleshoot, buy cheap RAM or a cheap power supply and you will more than likely regret it. There are several reasons to upgrade the RAM in your computer such as to boost performance, increased requirements of a new software application, planning to run virtual machines, etc.

Startup Items with Unicode Filenames on Windows XP

Several end user personal computers that I’ve looked at recently have had some strange file names showing up in their startup routine. Here’s a look at what Msconfig showed: Attempting to disable these two entries via MSConfig generates an access denied error. The normal spyware programs that I run haven’t been able to detect these items either. The only way I’ve found to disable them is via the registry: µ

Microsoft Windows Server Update Services 3.0 SP2 (WSUS)

I typically work as a systems engineer in the SMB sector and WSUS is one of the products that in my opinion is a no brainer to implement. It’s free with Windows Server 2003 or 2008 (and Vista & Windows 7 I’m told, although I have not verified this). It can easily be implemented by your present IT staff and can reside on an existing IIS webserver server as long as there is enough local disk space to hold the updates.

Empty Start Menu on Windows Server 2008 Terminal Server

Recently while assisting one of my customers who was transitioning from Windows 2003 to Windows 2008 terminal servers we experienced a problem with start menu redirection where there was nothing at all on a user’s start menu. The start menu was (empty) or blank. This problem ended up being due to applying the same group policy to the 2008 terminal servers that was previously applied to the 2003 terminal servers. To resolve this issue the “Remove user’s folders from the Start Menu” setting that was previously enabled in the group policy object (GPO) and worked without issue on Windows Server 2003 needs to be disabled on the new Windows Server 2008 terminal servers.

Enabling Remote Access to Device Manager on Server Core

You’ve added hardware to a Windows Server 2008 R2 Core installation machine and you want to check the status of it through the GUI by using Device Manager on a remote computer. The following process allows you to access Device Manager remotely in “Read Only” mode and it assumes that you’ve already configured remote management on your core server through option 4 of sconfig. You’re already able to access the event logs and/or services using Computer Management on a remote computer.

Scheduling your Blog Posts

You may think I woke up early today which is Thanksgiving morning to write this blog post, but WordPress has a scheduling feature that allows you to write your blog posts days, weeks, or even months ahead of time and schedule when you’d like to have them published. This allows you to add a level of professionalism to your blog by publishing articles on a more consistent basis instead of posting ten in a day and then not posting anymore for months.

Adobe Reader 9 update issues on Terminal Server

You’re using group policy to enforce the “Run only approved Windows applications” for a specific group of computers such as terminal servers. After updating Adobe Reader from version 9.0 to 9.2, users receive the message: “This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator.” My first thought was “The name of the executable must have changed”. A quick check disproved that. It is the same name with both versions: “AcroRd32.

Dell Systems Build DVD Removes All Existing Partitions

So you’ve built a server and partitioned the RAID array into two logical partitions, one for the operating system and one for the data. For whatever reason, you need to reload the operating system on the server and you think you can format the OS partition and reload it without loosing the data that’s on your data partition. If you were booting directly to an operating system CD or DVD, that would be true, however if you boot to the Dell Systems Build DVD and attempt to reload the operating system with it, it will perform a step of “Clearing Existing Partitions” even if you choose to retain the existing RAID configuration.

Please wait for the System Event Notification Service…

One of my customers that I provide level 3 support for recently contacted me with an issue where their system would hang on the message “Please wait for the System Event Notification Service…” when they attempted to logout of their Windows 2008 terminal server: We determined that their terminal server had recently received an update to Windows Live Messenger via Windows Update that was causing this issue. Removing Windows Live Messenger from their terminal server resolved their logout issues.

How to Activate Windows Server 2008 Core Installation

To change the serial number on your Windows Server 2008 Core Installation, run “slmgr /ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX” where X is your new serial number. Wait for the popup confirmation message that the serial number has been changed: Run “cscript c:\windows\system32\slmgr.vbs -ato” to activate the operating system: µ

Communication Issues between Exchange Servers

Recently while transitioning one of my customers from Exchange 2007 to Exchange 2010, I experienced issues trying to replicate public folders between the servers. This was due to a larger mail flow communications problem between the two servers where mail between them was queuing up and never being delivered. To determine if you are experiencing this particular issue or not, use the Queue Viewer which is located in the toolbox section of the “Exchange Management Console”.

Exchange 2010 Implementation Tip for Antivirus

Prior to implementing Exchange Server 2010, check with your current Antivirus vendor to validate their product is supported on Exchange 2010. The messaging agent component of Trend Micro Worry-Free Business Security Advanced 6.0 will not install and is not supported on a server running Exchange 2010. WFBS Advanced 7.0 will fully support Exchange 2010 and is scheduled to be released in the fourth quarter of 2010. Trend Micro is current providing their WFBS Advanced customers with a temporary license for their SMEX 10.

Exchange 2010 Implementation Tip for Backup Exec 2010 Users

You should plan to move your Backup Exec 2010 Media Server to 64bit before implementing Exchange Server 2010. A Backup Exec 2010 Media Server that is running a 32bit operating system is unable to backup an Exchange 2010 Information Store. This is because Microsoft does not support 32bit Exchange Management Tools for Exchange 2010. Here’s the error message you’ll receive if you attempt to backup an Exchange 2010 Information Store with a 32bit Backup Exec 2010 Media Server:

Unable to view PDF documents hosted on an IIS 7.5 Web Server

If you’ve recently migrated a web server that houses downloadable PDF documents to IIS 7.5, your users may be encountering issues viewing some of the PDF documents in a web browser. This is due to a change in the way IIS 7.5 handles the downloading of PDF documents. It doesn’t affect all versions of Adobe Reader and it doesn’t affect all PDF documents so it is very difficult to troubleshoot. Updating Adobe Reader to the latest version on the client end will normally resolve the problem.

Unable to connect to a Castelle FaxPress 5000 – Solid Red Alarm

You are no longer able to communicate with your Castelle FaxPress 5000 device. The red light is on solid and the green light is off. Whether this is a new installation, you’ve moved the back-end portion of the software to a new server, or nothing has changed that you’re aware or, here is a major pitfall that you may want to look into before scrapping the device and looking for an alternative solution.

Mailbox Move Failure on Exchange 2010

You’ve attempted to move mailboxes to your new Exchange 2010 server and you receive the following error: _Active Directory operation failed on dc1.domain.name. This error is not retriable. Additional information: Insufficient access rights to perform the operation. Active directory response: 00002098: SecErr: DSID-03150BB9, problem 4003 (INSUFF_ACCESS_RIGHTS), data 0 The user has insufficient access rights. Exchange Management Shell command attempted: 'dc1.domain.name/users/test user' | New-MoveRequest-TargetDatabase 'Mailbox Database 1' Subsequent attempts to move the mailbox result in the following error: _The queue in ‘Mailbox Database 1’ database already contains a move request for ‘Test User’, while AD reports the mailbox as not being moved.

Change OWA Logon Format to UPN on Exchange 2007/2010

To change the logon screen of your OWA website to ask for the user principal name (UPN) or email address instead of “Domainuser name”, change the following to “User principal name (UPN)”. To access this screen, from within Exchange Management Console, go to “Server Configuration>Client Access”, right click the OWA website listed under the “Outlook Web App” tab, select properties, and click the “Authentication” tab: Before: After: µ

Get-OWAVirtualDirectory Access is Denied on Exchange 2010

When attempting to open “Server Configuration>Client Access” from the Exchange Management Console, you receive the following error: _An IIS directory entry couldn’t be created. The error message is Access is denied. HResult = -2147024891 It was running the command ‘Get-OwaVirtualDirectory’. _ Running the command listed in the error in the Exchange Management Shell gives you some additional information: To resolve this issue, add the “domainExchange Trusted Subsystem” group to the local administrators group of all of your exchange servers_.

Multipath I/O Installation on Windows 2008 R2 Server Core

To determine if the Multipath I/O feature has been installed, login to your core server and run oclist.exe: If you already know the name of the feature or role your looking for, you can save yourself some time by piping the output of the oclist.exe command to the find.exe command. The /I parameter makes the search case insensitive. To install the MultipathI/O feature, run “start/w ocsetup.exe MultipathIo”. The name of the feature is case sensitive.

iSCSI Initiator Configuration on Windows 2008 R2 Server Core

This blog will guide you through the necessary steps of connecting the iSCSI initiator on Windows Server 2008 R2 Server Core to an iSCSI target or volume on a Storage Area Network. I prefer server core for the host operating system on my Hyper-V virtualization servers, but some things such as the iSCSI Initiator settings are easier to configure through a GUI. Luckily Microsoft has included the iSCSI Initiator control panel applet as part of R2.

Dell EqualLogic PS4000 – Creating a Volume

You’ve followed the steps in my Initial Configuration of a Dell EqualLogic PS4000 SAN blog and now your ready to start carving up the disk space on your new Storage Area Network. Open Internet Explorer and browse to the management IP Address you assigned to your SAN group. Login with the “grpadmin” account when prompted. On the initial screen, underneath “Activities”, click “Create Volume”: Enter a meaningful name and description that follows your company’s naming convention:

Initial Configuration of a Dell EqualLogic PS4000XV SAN

Unpack your new Dell EqualLogic PS4000 Storage Area Network, install it in the server rack, and cable it up. A dedicated iSCSI network that is totally separate from your normal network is required. Depending on your existing environment, you could create a separate VLAN on existing gigabit Ethernet switches to separate the iSCSI traffic from normal network traffic or you could purchase two dedicated gigabit Ethernet switches and place them in a stacked configuration or connect them via a crossover cable.

Dell EqualLogic PS4000XV Storage Area Network

One of my customers recently purchased a Dell EqualLogic PS4000XV Storage Area Network (SAN). Here are some pictures of the unit. Front of the Unit. Sixteen 3.5″ Hard Drives in 3U of space: Back of the Unit. Dual Power Supplies and Controllers: 9.6Tb of Storage via sixteen 600Gb 15K SAS Hard Drives: Front of the controller card: Back of the controller card: Power Supply: Power Supply Fans: This seems to be a very cool piece of hardware for the SMB sector.

How to change the IP Address on SCO Unix

One of my customers re-addressed their entire internal network to a new ip-address range to allow for future growth and DHCP server redundancy. They have a legacy Unix machine sitting in the corner that no one knows anything about, but they still need to access it for legacy data. I’m not a Unix guy so there may be easier ways to do this, but here’s how I changed the ip-address:

Joomla Invalid Session Error

Problem: Today when attempting to login to the administrator (administration) portion of one of my customers Joomla websites, I received an “Invalid Session” error. Internet Explorer only shows the error in the URL and just redirects you back to the login page: https://mikefrobbins.com/administrator/index.php?mosmsg=Invalid Session Google Chrome actually shows an “Invalid Session” error on the login page: Solution: You have a session directory specified in your php.ini file that does not exist: session.

SharePoint Web Parts that Connect to the Internet

A weather web part on your corporate intranet home page is something that sounds like a great idea since it will increase your end users productivity by reducing the amount of time they spend visiting weather web sites. One downside to adding these types of web parts is they could give the perception that your intranet is inaccessible in the event of an Internet outage. A few days ago, while at one of my customers sites, they experienced a major telecom outage.

Active Directory Time Synchronization Problems with Hyper-V

One of my customers contacted me today with an issue where the time on all of their servers was off by about 8 minutes or so. My first thought was “which Active Directory domain controller is their authoritative time server?” and “I’ll update the time on it manually and then set it up to synchronize from an Internet time server”. By default, the authoritative time server for your organization is the server that holds the PDC Emulator FSMO role in the forest root domain.

Microsoft Office 2010 First Impressions – Day 1

At this point, I have about a day’s worth of Office 2010 experience under my belt and my favorite new feature so far is in PowerPoint. I typically use a third party product to convert narrated PowerPoint presentations to streamable media. PowerPoint 2010 natively supports saving to a “Windows Media Video” (wmv) file format: The only issue I have found is that PowerPoint does not have any advanced options to compress the video.

How to Toggle Field Codes Off or On in Microsoft Word

A few days ago a customer contacted me with a Microsoft Word 2007 problem. Codes such as “{ HYPERLINK “mailto:testuser@test.local” }” and “{ DATE @ “MMMM d, yyyy” }” were showing up in one of their documents. This problem is due to “Field Codes” being somehow toggled on. If the problem is with a single document, toggle the field codes off or on by first selecting the entire document with (cntl+a) and then toggle the field codes off or on with (shift-F9).

Installing MOSS 2007 on Windows Server 2008 R2

I recently built a test machine with Windows Server 2008 R2 and Microsoft Office SharePoint Server (MOSS) 2007. Before you get started with the MOSS installation, you need to add the .Net Framework 3.5.1 feature to your server and the Web Server (IIS) role. If you do not add the Web Server role manually, the MOSS installation will add it for you, but you’ll run into difficulties later. I’ve previously installed MOSS 2007 and WSS 3.

How to use CamStudio to create training videos

This is my first attempt at embedding a video blog on my blogging website and I thought what would be more ironic than a training video on how to create training videos. µ

Using HP MFP Digital Sending Software 4.x with a Castelle FaxPress

Problem: Your Castelle FaxPress will not send faxes created with a HP Digital Sender using the HP MFP Digital Sending Software 4.x (DSS). The 4.x version of the HP MFP Digital Sending Software defaults to long filenames when setting it up for use with a fax product. A Castelle FaxPress does not support long file names and will not pick up the fax files even though everything else is set up correctly.

HP MFP Digital Sending Software on Windows Server 2008

I recently updated and migrated some HP MFP Digital Sending Software (DSS) from version 4.13 to 4.16 and from a Windows 2003 Server to a Windows 2008 Server. One thing to note is that even the newest version of the HP DSS Software (4.16) will not run on a 64bit operating system so the newest operating system that can be used is a 32bit version of Windows 2008 (non-R2 since R2 is 64bit only).

Joomla 1.5 on Windows Server 2008 R2

I will be diving into the dark side with this blog since I prefer working with Microsoft based technolgies such as SharePoint and ASP.NET. Each time I work with PHP and MySQL, it seems like it takes a little Voodoo to make them work. This blog is the bare minimum configuration to get Joomla working on a Windows 2008 R2 Server with Apache, PHP, and a remote MySQL server. First, download the latest version of Apache HTTP Server win32 binary without crypto MSI installer, PHP VC6 thread safe zip file, MySQL Community Server essential 64 bit MSI installer, and Joomla.

Using Wyse Winterms in the Enterprise to Reduce TCO

Wyse Winterms are a cost effective solution for non-power users in your enterprise environment. They are great for users who use office, email, the Internet, etc, and they will handle most of the main stream applications that I have seen in the educational, financial, healthcare, and manufacturing industries. Models like the retired 1200LE and its replacement, the S10 are good choices. They are low cost, easy to maintain, are more eco-friendly than computers since they use a lot less power (average power usage for the S10 is 6.

Migrate Active Directory from 2003 R2 to 2008 R2 Server Core

This blog will step you through the process of migrating your Active Directory domain controllers from Microsoft Windows Server 2003 R2 to Windows Server 2008 R2 Server Core. Server Core is an excellent choice for dedicated domain controllers since it requires less maintenance, has a reduced attack surface, requires less management, and will run on less hardware. Lots of people are scared off by Server Core because there’s no GUI. To be honest with you, it’s a blessing in disguise since you shouldn’t be managing your production Active Directory environment directly on your domain controllers anyway.

How to create an Administrative shortcut.

As most systems administrators know, you should log into your computer as a normal domain user who does not have elevated privileges in your Active Directory domain and only run administrative programs with elevated privileges when necessary. You could hold down shift, right click the shortcut, and select “Run as different user” to run a program as a user who has elevated privileges in your Active Directory domain, but there’s an easier, more efficient way to run programs that always require elevated privileges.

System State Backup Failures with Symantec Backup Exec

Problem: You receive the message: “The job failed with the following error: A failure occurred accessing the object list.” in your backup job notification email when attempting to backup the system state of a Windows 2008 Server with Symantec Backup Exec. The actual error from the backup server job is: “e000fedd - A failure occurred accessing the object list.” and the error code is: “V-79-57344-65245”. Solution: This error is fairly generic and can be caused by several different problems; the issue I encountered was specifically due to using the combination of Trend Micro Worry-Free Business Security Advanced (Antivirus), Symantec Backup Exec 12.

Initial Configuration of a WatchGuard Firebox X750e

The Instructions listed below are designed to assist you in performing a basic configuration on a new (out of the box) WatchGuard Firebox X750e: Record the serial number of the Firebox: _____________ Log into https://www.watchguard.com/activate and register the firewall. Save the appliance feature key that is provided during the registration process to a text file. It should look similar to this: Serial Number: XXXXXXXXXX License ID: XXXXXXXXXX Name: XXXXXXXXXX Model: XXXXXXXXXX Version: XXXXXXXXXX Feature: XXXXXXXXXX Feature: XXXXXXXXXX Feature: XXXXXXXXXX Feature: XXXXXXXXXX Feature: XXXXXXXXXX Feature: XXXXXXXXXX Feature: XXXXXXXXXX Feature: XXXXXXXXXX Expiration: XXXXXXXXXX Signature: XXXXXXXXXXXXXXXXXX

Remove the header row from a SharePoint list.

Problem: You’ve added a picture column to your SharePoint “Announcements” list and you now have an unwanted column header that shows up. You only want to remove the column header for specific lists. This method can be used to hide the column header on any individual list. Solution: Create a custom view style that doesn’t show the header row and can easily be applied to individual SharePoint list views. As a best practice, make a copy of the VWSTYLES.

Associate SharePoint Documents with Application Specific Icons

Problem: You can’t tell what types of documents are in a SharePoint document library because they show a blank icon: Solution: Add an icon for the document types. For pdf’s, download the small 17×17 pdf icon from Adobe: https://www.adobe.com/misc/linking.html. Save the icon to the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATEIMAGES folder on your SharePoint server. As a best practice, make a copy of the DOCICON.XML file located in c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATEXML on your SharePoint server before modifying it in the step below.

Problem opening pdf documents in Windows 7

Problem: When attempting to open a pdf document by clicking on a hyperlink from within Windows 7, you receive a blank error message with Adobe Reader in the title and a question mark for the error message. Clicking on the OK button only displays a blank web page and does not open the pdf document. Solution: Installing all the available updates from the Adobe Reader 9 help menu > check for updates sub-menu option appears to resolve this issue.

Remotely Manage Hyper-V from Windows 7

Problem: You need to remotely manage your Hyper-V server from Windows 7. Solution: Download and install the “Remote Server Administration Tools for Windows 7” from Microsoft: https://www.microsoft.com/downloads/details.aspx?FamilyID=7d2f6ad7-656b-4313-a005-4e344e43997d&displaylang=en. Enable the Hyper-V Tools from “Control Panel>Programs>Turn Windows features on or off” menu: You should now have a “Hyper-V Manager” shortcut on your Administrative Tools menu. µ

Creating a Shared Mailbox in Exchange 2007

Open Exchange Management Shell and execute the New-Mailbox cmdlet using the following example as a template: New-Mailbox -Alias MySharedMailbox -Name 'My Shared Mailbox' -Database 'MAIL1\First Storage Group\Mailbox Database' -OrganizationalUnit 'mikefrobbins.demo/My OU/Users/Mailbox' -Shared -UserPrincipalName mysharedmailbox@mikefrobbins.demo The following cmdlet assigns full access for the mailbox to a group in Active Directory named “My Shared Mailbox Admins” which needs to exist in AD prior to executing this command: Get-Mailbox -Identity 'My Shared Mailbox' | Add-MailboxPermission -User 'My Shared Mailbox Admins' -AccessRights FullAccess This cmdlet allows members of the “My Shared Mailbox Admins” group in Active Directory to be able to send email from the “mysharedmailbox@mikefrobbins.

Remote Management of Hyper-V Server or Server Core

Problem: You receive an error Virtual Disk Manager “The RPC server is unavailable” when attempting to remotely manage Hyper-V Server 2008 or Windows Server 2008 Core Installation: Solution: Run the following command on the client and on the server: netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes You have the option of using the Server Configuration menu on the server side if your using Hyper-V Server 2008. Select option 4, Configure Remote Management:

Hyper-V Server 2008 R2 Server Configuration Menu

Problem: You’ve closed the Hyper-V Server 2008 R2 Server Configuration menu and need to re-open it: Solution: The command to re-open this window has changed with the R2 release. The new command is sconfig.cmd, with the non-R2 version, the command was hvconfig.cmd. Start Windows Task Manager by pressing Ctrl & Shift & Esc. Click File>New Task: Type cmd.exe /k C:\Windows\system32\sconfig.cmd and click ok: You now have a new Server Configuration window:

Hyper-V Server or Server Core Command Prompt Window

Problem: You’ve closed your command prompt window on Hyper-V Server 2008 or Windows Server 2008 Core Installation and need to re-open it: Solution: Start Windows Task Manager by pressing Ctrl & Shift & Esc. Click File>New Task: Type cmd.exe and click ok: You now have a new command prompt window: µ

Removing the LAN Manager Hash security risk

Problem: Windows stores a LAN Manager Hash for backwards compatibility with older operating systems. These Hash values are stored in local SAM databases and Active Directory. They are considered to be a major security risk and should be disabled unless you are running Windows 95, Windows 98, or Macintosh Outlook 2001 Clients. Solution #1: Using group policy to disable the LAN Manager Hash is the recommended solution since you can easily push the settings out to all of your workstations and servers.

Infrastructure Master FSMO Role Placement

The Infrastructure Master Role is one of the three domain operations masters. Its placement is like many other questions in Information Technology, that is, it depends. It depends on the number of domains in the forest and whether or not all domain controllers in a particular domain have been designated as a global catalog server. The infrastructure master is responsible for updating its domains references to objects in other domains in a multi-domain forest by checking its references with the global catalog.

Microsoft Office Outlook has stopped working

Problem: I’m currently ruuning Windows 7 Ultimate Edition and Office 2007 Professional Plus. I receive “Microsoft Office Outlook has stopped working Windows is checking for a solution to the problem” just about everytime I use Outlook: " Application Event Log Error Message: Event ID: 1000 Task Category: (100) Level: Error Description: Faulting application name: OUTLOOK.EXE, version: 12.0.6504.5000, time stamp: 0x49e7f47e Faulting module name: olmapi32.dll, version: 12.0.6504.5000, time stamp: 0x49e7f423 Exception code: 0xc0000005 Fault offset: 0x00051a61 Faulting process id: 0xc1c Faulting application start time: 0x01ca340a023dfe6b Faulting application path: C:\Program Files (x86)\Microsoft Office\Office12\OUTLOOK.

Extend the Activation Grace Period of a Windows Operating System

Problem: You are evaluating or testing a Windows Operating System and need to extend the activation grace period to complete your evaluation or testing. Solution: Extend or rearm the evaluation period. This process must be followed before the activation countdown reaches 0: Right click “Command Prompt” and select “Run as administrator”: Navigate to the C:\Windows\System32 folder and execute the following command. cscript slmgr.vbs /rearm Most documentation on this procedure references -rearm which works on Windows Vista and 7 but sometimes generates an error on certain Windows 2008 installations.

Outlook Security Alert

Problem: When opening Microsoft Outlook you receive a Security Alert “Information you exchange with this site cannot be viewed or changed by others. However, there is a problem with the site’s security certificate.” Solution: The self-signed certificate that was created during the Exchange 2007 installation expires after one year. Use Exchange Management Shell to validate this is the problem you’re experiencing by running the following cmdlet. Get-ExchangeCertificate | Format-List NotAfter shows the certificate expiration date, Services shows the mail services that are being used by a particular certificate, and Thumbprint will be used to resolve this problem if your certificate is indeed expired.

32bit App – 64bit OS ODBC Problem

Problem: ODBC data sources that are created with the “ODBC Data Source Administrator” located under “Administrative Tools > Data Sources (ODBC)” do not show up in 32 bit (x86) applications. Also, data sources created in 32 bit applications such as Visual Studio do not show up in the “ODBC Data Source Administrator”. This is due to the default shortcut for the “ODBC Data Source Administrator” being for 64 applications only.

Hyperlink Issues – MS Office

Problem: You receive the error message “This operation has been cancelled due to restrictions in effect on this computer. Please contact your system administrator” when clicking on a hyperlink from any office application after updating Internet Explorer to version 7 or 8. The specific error I received was: Solution: Change the registry value in [HKEY\_CLASSES\_ROOT\htmlfile\shell\open\command] from C:\Program Files\Internet Explorer\IEXPLORE.EXE-nohome to C:\Program Files\Internet Explorer\iexplore.exe -nohome . The update of Internet Explorer apparently changes the executable name in the registry to upper case.

Vista and 7 x64 Audio Codec Problem

Problem: An important audio codec is missing from 64bit versions of Windows Vista and Windows 7. Some media files generate an error when using Windows Media Player. Third party media players seem to be affected as well, since some will play the video portion with no audio, and others won’t play the media file at all. This problem even occurs with media files downloaded from Microsoft. The Windows Media Player specific error is: “Windows Media Player cannot play, burn, rip, or sync the file because a required audio codec is not installed on your computer.

About

Mike F. Robbins is a former Microsoft MVP, creator of The PowerShell Conference Book, author of PowerShell 101: The No-Nonsense Beginner’s Guide to PowerShell, co-author of Windows PowerShell TFM 4th Edition, and a contributing author in the PowerShell Deep Dives book. Mike has been a strong supporter of the PowerShell community and is now the lead technical writer for Azure PowerShell at Microsoft. He blogs at mikefrobbins.com and can be found on twitter @mikefrobbins.