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 ‘new-object’

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 »

TechMentor 2008 San Francisco - Auditing Examples

Tuesday, March 25th, 2008 by Don Jones
This are examples from Don's "Pass Your Next Audit By Using Windows PowerShell" session. They're also great examples of how to use filtering functions and custom objects to produce flexible, customized output with Windows PowerShell. Auditing with PowerShell Examples  …   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).