A method is a callable operation associated with one object. It tells that object to perform an action, such as terminating a process, changing a string, or calculating a date. Properties provide information; methods perform operations; both are members of an object. section 8.1 section 26.3
Use these practical rules when working with methods:
- Discover methods by piping an object to Get-Member, or use its alias gm: Get-Process | gm. section 8.3
- Call a method after a period and always add parentheses, even when it takes no parameters; put required arguments inside the parentheses. section 15.5.4
- Use ForEach-Object when calling a method for each piped object: Get-ChildItem | ForEach-Object { $_.Delete() }. section 15.5.4 section 15.7
- Prefer a cmdlet when one provides the same administrative action; Stop-Process is usually simpler than directly calling a process object's Kill method. section 8.5
Manipulating strings and dates
Strings and dates expose useful methods. `$computername.ToLower()` converts SERVER17 to server17, while `$username.Trim()` removes surrounding spaces. To calculate an earlier date, assign `Get-Date` to `$today`, then use `$today.AddDays(-90)`; use `.ToShortDateString()` for a short format. section 26.3 section 26.4
Get-Process | gm
Inspect a process object's type, properties, and available methods with Get-Process | gm before deciding how to act on it. section 8.3
Methods behave differently across remoting boundaries. Objects returned from remoting are generally deserialized, read-only copies without operational methods; put actions in the remote script block while objects remain live. section 13.7.1



















