PowerShell script exchange
Post Reply
EvoTom
Enthusiast
Posts: 26
Liked: 1 time
Joined: Jul 11, 2012 10:18 am
Contact:

Using Methods

Post by EvoTom » May 20, 2014 10:53 am

Hi

I'm trying to do some automating with Veeam and PowerShell. I'm looking at some code and modifying it for my own script. The snipped I am looking at is this:

Code: Select all

Get-VBRJob | ? {$_.FindLastSession().EndTime} | Select Name, {$_.FindLastSession().EndTime}
Now, I know what this does (lists the jobs and their end time), but what I want to know is how can I see what options there are for the method FindLastSession(). ie I know of three (.EndTime , .CreationTime and .Result) but how do I find them all and what they do.

I realise this is more a general PowerShell query but any help would be appreciated.

nefes
Veeam Software
Posts: 616
Liked: 153 times
Joined: Dec 10, 2012 8:44 am
Full Name: Nikita Efes
Contact:

Re: Using Methods

Post by nefes » May 20, 2014 11:00 am

To find out the set of methods that is available for some object, you can do the following:
1. Create some variable containing object of interest. In your case it will be:

Code: Select all

$session = (Get-VBRJob)[0].FindLastSession()
2. Use Get-Member on it:

Code: Select all

$session | Get-Member
You will see the list of available fields and methods.

EvoTom
Enthusiast
Posts: 26
Liked: 1 time
Joined: Jul 11, 2012 10:18 am
Contact:

Re: Using Methods

Post by EvoTom » May 23, 2014 10:21 am

Perfect, thanks for the help.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests