Using Methods

PowerShell script exchange

Using Methods

Veeam Logoby EvoTom » Tue 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.
EvoTom
Enthusiast
 
Posts: 25
Liked: never
Joined: Wed Jul 11, 2012 10:18 am

Re: Using Methods

Veeam Logoby nefes » Tue 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.
nefes
Veeam Software
 
Posts: 534
Liked: 125 times
Joined: Mon Dec 10, 2012 8:44 am
Full Name: Nikita Efes

Re: Using Methods

Veeam Logoby EvoTom » Fri May 23, 2014 10:21 am

Perfect, thanks for the help.
EvoTom
Enthusiast
 
Posts: 25
Liked: never
Joined: Wed Jul 11, 2012 10:18 am


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests