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
PowerShell Basics

bookWorking with Objects

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

PowerShell is fundamentally different from traditional command-line interfaces because it is object-oriented. Instead of working with plain text, PowerShell commands output structured units called objects. Each object contains both properties—which hold data—and methods—which are actions that can be performed on the object. This approach allows you to manipulate data more precisely, filter information efficiently, and build robust automation scripts. Understanding objects is essential for making the most of PowerShell’s capabilities, especially when working with complex data or chaining commands together in pipelines.

1234
# Example: Using Get-Process to retrieve and display object properties in PowerShell # Retrieve all running processes and display their names and IDs Get-Process | Select-Object -Property ProcessName, Id
copy

When you use a command like Get-Process, PowerShell returns a collection of process objects. Each process object has properties such as ProcessName, Id, CPU, and more. You can access any property using the dot notation. For example, $process.Id gives you the process ID. Beyond properties, objects also have methods, which are built-in actions you can call. For instance, if you store a process object in a variable, you can use $process.Kill() to stop that process. This ability to access both data and functionality through objects is what makes PowerShell so powerful for automation and administration.

question mark

In PowerShell, what is an object?

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

すべて明確でしたか?

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

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

セクション 2.  1

AIに質問する

expand

AIに質問する

ChatGPT

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

セクション 2.  1
some-alt