ItemCmdletProviderIntrinsics.New Method

Definition

Overloads

New(String, String, String, Object)

Creates a new item at the given path.

New(String[], String, String, Object, Boolean)

Creates a new item at the given path.

New(String, String, String, Object)

Creates a new item at the given path.

C++
public:
 System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ New(System::String ^ path, System::String ^ name, System::String ^ itemTypeName, System::Object ^ content);

Parameters

path
String

The path to the container to create item in. It may be a drive or provider-qualified path and may include glob characters.

name
String

The name of the new item to create.

itemTypeName
String

The type of the new item to create.

content
Object

The content of the new item to create.

Returns

The item that was created.

Exceptions

If path or propertyToClear is null.

If the path refers to a provider that could not be found.

If the path refers to a drive that could not be found.

If path does not contain glob characters and could not be found.

If the provider that the path refers to does not support this operation.

If the provider threw an exception.

Applies to

PowerShell SDK 7.4.0 et autres versions
Produit Versions
PowerShell SDK 7.2.0, 7.3.0, 7.4.0
Windows PowerShell 5.1.0.0

New(String[], String, String, Object, Boolean)

Creates a new item at the given path.

C++
public:
 System::Collections::ObjectModel::Collection<System::Management::Automation::PSObject ^> ^ New(cli::array <System::String ^> ^ path, System::String ^ name, System::String ^ itemTypeName, System::Object ^ content, bool force);

Parameters

path
String[]

The path(s) to the container to create item in. They may be drive or provider-qualified path and may include glob characters.

name
String

The name of the new item to create.

itemTypeName
String

The type of the new item to create.

content
Object

The content of the new item to create.

force
Boolean

Passed on to providers to force operations.

Returns

The item(s) that was created.

Exceptions

If path or propertyToClear is null.

If the path refers to a provider that could not be found.

If the path refers to a drive that could not be found.

If path does not contain glob characters and could not be found.

If the provider that the path refers to does not support this operation.

If the provider threw an exception.

Applies to

PowerShell SDK 7.4.0 et autres versions
Produit Versions
PowerShell SDK 7.2.0, 7.3.0, 7.4.0
Windows PowerShell 5.1.0.0