Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ Working with Objects | PowerShell Objects and Pipelines
Introduction to PowerShell

Working with Objects

メニューを表示するにはスワイプしてください

PowerShell differs from traditional command-line interfaces because it is object-oriented. Instead of producing plain text, PowerShell commands return structured objects. Each object contains properties, which store data, and methods, which define actions that can be performed on that object.

This object-based approach makes it easier to filter, sort, and manipulate data without relying on text parsing. It also enables you to build more reliable and powerful automation scripts by passing objects directly between commands through the PowerShell pipeline. Understanding how objects work is a fundamental step toward using PowerShell effectively.

When you run a command such as Get-Process, PowerShell returns one or more process objects. Each object contains a variety of properties, including values like ProcessName, Id, and CPU.

You can access a property's value using dot notation. For example, if a process is stored in the variable $process, you can retrieve its process ID with:

$process.Id

Objects also include methods, which are actions that can be performed on them. For example, the Kill() method terminates a process:

$process.Kill()

By exposing both data through properties and functionality through methods, PowerShell objects provide a flexible and powerful way to interact with the operating system and automate administrative tasks.

question mark

In PowerShell, what is an object?

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 2.  1

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 2.  1
some-alt