The New-Object cmdlet is basically* legacy.
Since PowerShell V3.0 (12 years ago), PowerShell supports type accelerators which perform much better, see: PowerShell scripting performance considerations / object creation.
*) Exceptions left there (e.g. with the use of the [-ComObject] <String> parameter)
Therefore I think that it makes sense to have a AvoidNewObjectCmdlet rule.
related: Avoid New-Object Hashtable #60
The
New-Objectcmdlet is basically* legacy.Since PowerShell V3.0 (12 years ago), PowerShell supports type accelerators which perform much better, see: PowerShell scripting performance considerations / object creation.
*) Exceptions left there (e.g. with the use of the
[-ComObject] <String>parameter)Therefore I think that it makes sense to have a
AvoidNewObjectCmdletrule.related: Avoid New-Object Hashtable
#60