Tag: PowerShell

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. Singapore is 13 hours ahead of central time zone in the USA Read more [...]

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 Read more [...]

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 Group meeting. This is a physical meeting, but they have made their meetings available via Microsoft Lync as well. October 8th - Mississippi PowerShell User Group meeting. Our user Read more [...]

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. I would like Read more [...]

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 Read more [...]

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 Read more [...]

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 Read more [...]

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. Then the param block is opened which Read more [...]

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: 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: Who knows what that regular expression does? The guy who wrote this might, but probably no one Read more [...]

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 Rouge this 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. I'm not sure how many tickets are available at this point before this free technology Read more [...]

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). This isn't your ordinary PowerShell book. The PowerShell Deep Dives book is designed to be like "A conference in a book" and contains 28 chapters divided up into Read more [...]

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 Read more [...]

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 Read more [...]

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 Read more [...]

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. It kind of reminds me of how the Active Directory cmdlets are implemented. Read more [...]