New-Object
Use New-Object to create .NET objects, COM objects, and custom PSObjects — from web clients and lists to script-defined objects.
Documentation: Microsoft Learn — new-object
Syntax
Try it
PowerShell example · browser support is limited.
Execution scope: The full example below requires PowerShell outside this browser. You can edit this runner to use the supported practice commands; unsupported syntax returns an explanation.
Examples
Create a growable list
Show reference output
Illustrative output · values vary by environment
server01 server02
Download a file with a .NET web client
Show reference output
Illustrative output · values vary by environment
(file downloaded to C:\Temp\report.csv)
Build a custom object with properties
Show reference output
Illustrative output · values vary by environment
Name Role Status ---- ---- ------ SRV01 Database Online
Parameters
Parameter definitions:
-TypeName— The full .NET type name, such as System.Net.WebClient.-ArgumentList— Arguments passed to the type's constructor.-Property— A hashtable of property names and values set on the new object.-ComObject— The ProgID of a COM component to create, such as WScript.Shell. Windows only.
Prefer the modern syntax for new code
In PowerShell 5 and later, [System.Collections.ArrayList]::new() and [pscustomobject]@{ Name = 'x' } do the same jobs as New-Object with less typing and better performance. New-Object still matters for COM objects and for scripts that must run on older versions.
COM automation with -ComObject is Windows-only and needs the target application installed. It is also the classic way malware abuses PowerShell, so expect endpoint protection to flag scripts that create COM objects such as WScript.Shell or Shell.Application.
When adding items to an ArrayList, the Add() method returns the index of the new item, which pollutes your output. Pipe it to Out-Null or assign it to $null to keep the console clean.
Add properties to objects with Add-Member
Inspect object members with Get-Member
Updated 25 October 2026. Browser outputs are fictional; check the installed module help for your environment.
Recap
New-Object Use New-Object to create .NET objects, COM objects, and custom PSObjects — from web clients and lists to script-defined objects.
Next: Get Eventlog