O'Reilly logo

Learn PowerShell Toolmaking in a Month of Lunches by Don Jones and Jeffrey Hicks

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

12.2. Adding a type name to output objects

Because views are triggered by the type name of the object they display, we need to ensure our script’s output object has a unique type name. Right now it doesn’t: The script outputs a generic type of object called PSObject. The following listing shows how we’ll fix that, with a single line shown in boldface.

Listing 12.1. Adding a custom TypeName to the view
function Get-SystemInfo { <# .SYNOPSIS Retrieves key system version and model information from one to ten computers. .DESCRIPTION Get-SystemInfo uses Windows Management Instrumentation (WMI) to retrieve information from one or more computers. Specify computers by name or by IP address. .PARAMETER ComputerName One or more computer names or IP ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required