PowerShell script exchange
Post Reply
dragan.bodrozic
Novice
Posts: 8
Liked: 3 times
Joined: Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic
Contact:

How to list all objects

Post by dragan.bodrozic »

I want to list (Guest processing - Advanced - Guest processing settings) All objects (VMs) with his Account(s) in every jobs? How to do that? Something like this:
===========
Job1
===========
Object: VM1 Acount: Domain\User1
Object: VM2 Acount: Domain\User2
-------------------------------------------
===========
Job2
===========
Object: VM3 Acount: Domain\User1
Object: VM4 Acount: Domain\User1
Object: VM5 Acount: Domain\User2
-------------------------------------------
...
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to list all objects

Post by veremin »

Try this example and see whether it meets your expectations. I know it can be formatted better, but I don't have time to do it at the moment:

Code: Select all

Foreach ($Job in (Get-VBRJob | where {$_.VSSOptions.Enabled -eq $True}))
{
   "================================================================================" 
   $Job.Name
   "================================================================================"
   Foreach ($Object in ($Job.GetViOijs() | where {$_.VSSOptions.Enabled -eq $True}))
   {
       $Object | Select @{N="Object";E={$_.Name}}, @{N="Account";E={[Veeam.Backup.Core.CLinuxCredentials]::Find($_.VssOptions.WinCredsId).Credentials.Name}} | ft -AutoSize
   }
   "--------------------------------------------------------------------------------"
}
Thanks.
dragan.bodrozic
Novice
Posts: 8
Liked: 3 times
Joined: Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic
Contact:

Re: How to list all objects

Post by dragan.bodrozic »

No. Under Account there is nothing. I forgot to say version is V7 full patched.
Here are the screen results of execution of script:
===============================================================================
Job1
===============================================================================
Object Account
------ -------
VM1
Object Account
------ -------
VM2
Object Account
------ -------
VM3
Object Account
------ -------
-------------------------------------------------------------------------------
===============================================================================
Job2
===============================================================================
Object Account
------ -------
VM4
Object Account
------ -------
VM5
Object Account
------ -------
-------------------------------------------------------------------------------
...
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to list all objects

Post by veremin »

So, you were not talking about customizable guest OS "Credentials" for individual VMs and OSes, but rather about creds used for OS indexing?

By the way, is there any specific reason not to update to the latest product version, making use of new functionality along with improvements and enhancements?

Thanks.
dragan.bodrozic
Novice
Posts: 8
Liked: 3 times
Joined: Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic
Contact:

Re: How to list all objects

Post by dragan.bodrozic »

but rather about creds used for OS indexing?

Yes

No. Everything works ok and daily responsibilities does not allow me migrate to V8. Too much work for one man :D
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to list all objects

Post by veremin »

I think this script should do the trick for version 7:

Code: Select all

Foreach ($Job in (Get-VBRJob | where {$_.VSSOptions.IsIndexingRequired() -eq $True}))
{
   "================================================================================"
   $Job.Name
   "================================================================================"
   Foreach ($Object in ($Job.GetViOijs() | where {$_.VSSOptions.Enabled -eq $True}))
   {
       $Object | Select @{N="Object";E={$_.Name}}, @{N="Account";E={$_.VssOptions.Credentials.Name}} | ft -AutoSize
   }
   "--------------------------------------------------------------------------------"
}
Make sure to update to the version 8 Update 2, whenever you have time for it, as it's always recommended to stay updated.

Thanks.
dragan.bodrozic
Novice
Posts: 8
Liked: 3 times
Joined: Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic
Contact:

Re: How to list all objects

Post by dragan.bodrozic » 1 person likes this post

Good job. It works!
veremin
Product Manager
Posts: 20270
Liked: 2252 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: How to list all objects

Post by veremin »

You're welcome. Should other help with scripting be needed, I'd be glad to help. Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests