Browse CLASSROOM TRAINING REGISTER for classroom training CONTACT us

SAPIEN Solutions

SAPIEN homepage
PrimalScript script editor+ide
PrimalScope script debugger
Free Tools script utilities
SAPIEN Press tech books
ScriptingAnswers.com learn+share
ScriptingOutpost.com online store
Blog.Sapien.com official blog
Contact Us

 

Posts Tagged ‘add-member’

Custom Objects Example

Wednesday, April 9th, 2008 by Don Jones
We've long been advocates of outputting objects, rather than text, and of keeping individual functions very single-task-specific. Here's an ultimate example of these two philosophies: The first function, Get-DriveInventory, emits custom "drive inventory objects" rather than text. The second, Write-DriveInventory, takes these objects and writes their properties to a pre-designed…   More »

Emit custom objects, rather than text, from functions and scripts

Sunday, March 23rd, 2008 by Don Jones
Whenever possible, functions (especially) and scripts (to a lesser degree) should emit custom objects, not just text. This ensures that the output of these constructs can be piped to other cmdlets, like Where-Object, Sort-Object, and so forth, further extending PowerShell's capabilities. To create a custom object: $obj = New-Object PSObject…   More »


Entries (RSS) and Comments (RSS).