PowerShell script exchange
Post Reply
ben10
Lurker
Posts: 1
Liked: never
Joined: Jun 19, 2019 7:49 am

Powershell List of servers in Jobs exclude disabled jobs

Post by ben10 »

Hi,

I was looking for a way to export a list of servers within a job to a csv file but exclude the disabled jobs. I have only got the code to get the list of jobs so any help would be appreciated :)

Code: Select all

foreach ($job in Get-VBRJob) {Write-Host " Job:", $job.name; $job.GetObjectsInJob() | foreach { $_.Location }}
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell List of servers in Jobs exclude disabled jobs

Post by veremin »

Check this example:

Code: Select all

foreach ($job in (Get-VBRJob | where {$_.info.IsScheduleEnabled -eq $True})) {Write-Host " Job:", $job.name; $job.GetObjectsInJob() | foreach { $_.Location }}
Thanks!
mrholm
Expert
Posts: 170
Liked: 15 times
Joined: Apr 20, 2018 8:12 am
Full Name: Mats Holm
Contact:

Re: Powershell List of servers in Jobs exclude disabled jobs

Post by mrholm »

Hi
I was looking for the same thing and this script seems promising but we are always using Tags to set Virtual Servers in our jobs is it possible to have Veeam to read what VM's would be chosen by the tag?
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: Powershell List of servers in Jobs exclude disabled jobs

Post by jhoughes »

No, we cannot determine the VMs contained within the vSphere tag via the Veeam PowerShell cmdlets.

You'd have to leverage PowerCLI for that.
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell List of servers in Jobs exclude disabled jobs

Post by veremin »

Check this thread for more information regarding PowerCLI approach. Thanks!
Post Reply

Who is online

Users browsing this forum: No registered users and 15 guests