I am working in a script that will be run via Task Scheduler, but testing it initially through the VBR PowerShell Toolkit...
I have this line of code that should pull in all jobs and sort the in Descending value
$Jobs = Get-VBRJob | Sort-Object -Descending
When I view the output, it does not sort them. Does anyone know why or how to sort them correctly?
-
- Novice
- Posts: 7
- Liked: never
- Joined: Jun 06, 2018 2:29 pm
- Full Name: Troy Leanna
- Contact:
-
- VP, Product Management
- Posts: 27451
- Liked: 2822 times
- Joined: Mar 30, 2009 9:13 am
- Full Name: Vitaliy Safarov
- Contact:
Re: Sort-Object
Troy, how do you want to sort your jobs? Based on the time start, date, name or something else? There are some existing samples showing how you can query and sort objects using our PS snap-in, please take a look at them.
-
- Novice
- Posts: 7
- Liked: never
- Joined: Jun 06, 2018 2:29 pm
- Full Name: Troy Leanna
- Contact:
Re: Sort-Object
Sorry, I have been focused on my script that I did not see your reply... I was able to find some references on how to manipulate my script to perform this and have it working as I would like it to...
-
- Product Manager
- Posts: 20450
- Liked: 2318 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Sort-Object
You need to specify a property that will be used as a sorting parameter. For instance, if you want to sort job based on their names, use the following script:
Thanks.
Code: Select all
Get-VBRJob | Sort-Object -Property Name
Who is online
Users browsing this forum: No registered users and 13 guests