Invoke Object Methods in Windows PowerShell Scripts


How to invoke methods of an object in Windows PowerShell scripts? I know the method name in Windows PowerShell scripts.



If you know the method name of an object, you can invoke and run the method using the "." operator.

For example, if you run the following script:

$today = Get-Date
$tomorrow = $today.AddDays(1)
"Today is "+$today.DayOfWeek
"Tomorrow is "+$tomorrow.DayOfWeek

You will get something like:

Today is Saturday
Tomorrow is Sunday


Introduction of Windows PowerShell Script

⇒⇒Windows PowerShell Tutorials

2016-11-02, 331👍, 0💬