Video Tutorial

Create PowerShell Objects

PowerShell is object based scripting language and it is good practice to create objects to return, store and manipulate information instead of text. But are you aware that there are 4 ways to create objects in PowerShell:

  1. Convert Hashtables to [PSCustomObject]

    You can create hashtables and type cast them to PowerShell Custom Objects [PSCustomObject] type accelerator, this the fastest way to create an object in PowerShell


  2. Using Select-Object cmdlets

    You can also use the Select-object cmdlet to create objects with custom properties

  3. Using New-Object and Add-Member

    This is longer way to create PowerShell objects, first you instantiate class:PSObjectthen you use Add-Member cmdlet to add member properties to the object. You can also add methods using this method.

  4. Using New-Object and hashtables

    PowerShell also allows you to create hashtables and assign it as property to New-Object PSObject cmdlet.


If you like this article read more similar articles under ‘N – Ways to’ category


My New Book :  PowerShell Scripting Guide to Python

This PowerShell Scripting guide to Python is designed to make readers familiar with syntax, semantics and core concepts of Python language, in an approach that readers can totally relate with the concepts of PowerShell already in their arsenal, to learn Python fast and effectively, such that it sticks with readers for longer time.

“Use what you know to learn what you don’t. ” also known as Associative learning.

Book follows a comparative method to jump start readers journey in Python, but who is the target audience? and who should read this book –

  • Any System Administrator who want to step into Development or Programming roles, and even if you don’t want to be a developer, knowledge of another scripting language will make your skill set more robust.
  • Python Developers who want to learn PowerShell scripting and understand its ease of user and importance to manage any platform.

Python is one of the top programming languages and in fast changing IT scenarios to DevOps and Cloudto the future – Data ScienceArtificial Intelligence (AI) and Machine Learning Python is a must know.

But this PowerShell Scripting guide to Python would be very helpful for you if you already have some knowledge of PowerShell

NOTE! This is a Leanpub “Agile-published” book. That means the book is currently unfinished and in-progress. As I continue to complete the chapters, we will re-publish the book with the new and updated content. Readers will receive an email once a new version is published!

While the book is in progress, please review it and send any feedback or error corrections at [email protected]

Optical Character Recognition

Subscribe to our mailing list

* indicates required