Don Jones

Don Jones has more than 15 years of IT experience, is the author of more than 35 books, and is a speaker at technology conferences such as Microsoft TechEd and Windows Connections. He's a multiple-year recipient of Microsoft's MVP award and is a technical guide for PowerShell for Windows IT Pro.

Articles by Don Jones
6 small penguins on the ice
Q. How can I have my PowerShell script display output in a table?
Let's say you want your script to retrieve and display two pieces of information—the BIOS serial number and Windows version—it in a table.
screenshot of PowerShell script on blue screen
Q. Is PowerShell a scripting language?
Someone's going to get mad at me no matter which way I answer this, so I'll say "yes and no."
Pen on a paper with a chart on it
Q. Should I ever use Write-Host in PowerShell? 2
You should rarely use the Write-Host cmdlet. Write-Host puts content directly on the screen. If that's all you need to do, then you can use it.
PowerShell logo on light blue background with vertical lines
Q. How can I display output in Windows PowerShell?
This is a common question from folks who are used to using something like VBScript's WScript.Popup or WScript.Echo. There are a few choices.
Plane flying across blue sky with cloud trail
Q. Can I declare constants in Windows PowerShell?
To declare constants, you use the New-Variable cmdlet. It includes a switch that lets you define the new variable as a constant, meaning its value can't be changed.
laptop screen showing a line of black folders with one red folder
Q. How can I get just the first entry from a list of entries?
If you've saved the objects in a variable, as in these examples, you could also use syntax such as $services[0] to access the first object in the collection.
ski tracks on a snowy landscape
Q. How can I make a PowerShell script or function have mandatory parameters?
There are a couple of ways to have mandatory parameters. The best way is to use the [CmdletBinding()] parameter syntax, as described in PowerShell's about_functions_advanced_parameters Help topic.
Lava lamp with yellow blob on blue background
Q. How can I query processor cores or sockets using PowerShell? 1
To query processor cores or sockets, you run a script and follow specific procedures.
swimmer in pool lane view from above
Q. How can I run a PowerShell cmdlet against a remote computer?
If the cmdlet has a -computerName parameter, then just use that. Otherwise, you'll need to use remoting.
blue abstract shell on white background
Q. How do I make a PowerShell function support ShouldProcess?
To support support ShouldProcess, your function must include the [CmdletBinding(SupportsShouldProcess=$true)] attribute.
Laptop screen showing a laptop showing a laptop with birds
Q. How can I use a PowerShell cmdlet that's in a module on another computer?
You can use a PowerShell cmdlet that's in a module on another computer by using a feature called implicit remoting. Start by establishing a remoting session to the computer that contains the module you want.
Q. How do I enable PowerShell remoting in a domain environment? 2

A. You can enable PowerShell routing two ways. The first way is to run

Q. Why can't Invoke-Command accept computer names from the pipeline?

A. The Help file for the Invoke-Command cmdlet indicates that the -computerName parameter accepts pipeline input through ByPropertyName. This suggests that you can pipe in an object that contains a "computername" property and have that property "attach" to the -computerName parameter. Sadly, as near as I can figure out, it doesn't actually work, which seems to be an oversight on Microsoft's part. The -inputObject parameter of Invoke-Command binds any pipeline input of type "object" ByValue.

Q. How can I add syntax help to my PowerShell scripts or functions?

A. I've seen a number of folks spend a lot of effort adding a -help parameter to their scripts or functions—and there's no need! You can add help simply by creating specially formatted comments, as described in PowerShell's own online help. Run

Q. What is CmdletBinding()?

A. In PowerShell, you can run

NEW: Microsoft Hyper-V Master Class with John Savill

A new Master Class with John Savill! Get 12 hours of detailed instruction covering all the key aspects of a Hyper-V based virtualization environment.

During this training attendees will learn how to:

-- Architect a Hyper-V based virtualization solution.
-- Migrate from physical and other virtualization environments.
-- Implement a private cloud solution.

Thursdays, April 17th through May 8th
 

Upcoming Training

Deploying Windows 7 and Windows 8.1 with System Center Configuration Manager 2012 R2

Tuesday, May 6th @ 11am, 1pm, 3pm ET

In a single day you will learn to deploy Windows 7 and Windows 8.1 using System Center Configuration Manager 2012 R2 and MDT 2013. Johan Arwidmark guides you through the entire build process. You will learn about reference images, deployment of images, drivers injection, adding updates and applications and a great deal of real-world tips and tricks.

Enroll by April 29th and SAVE 15%
View All Online Training

IT/Dev Connections

Register now to get the best rates available!

Current Issue

April 2014 - The architectural components related to Hyper-V networking in System Center Virtual Machine Manager 2012 R2 can be confusing. Walk through all the VMM networking architectural components and how to use them.

CURRENT ISSUE / ARCHIVE / SUBSCRIBE

Windows Forums

The Windows IT Pro forums are moving to myITforum.com! Get answers to questions, share tips, and engage with the IT professional community.

Sponsored Introduction Continue on to (or wait seconds) ×