How to list all objects

PowerShell script exchange

How to list all objects

Veeam Logoby dragan.bodrozic » Fri Aug 28, 2015 4:18 pm

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
-------------------------------------------
...
dragan.bodrozic
Novice
 
Posts: 8
Liked: 3 times
Joined: Thu Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic

Re: How to list all objects

Veeam Logoby v.Eremin » Mon Aug 31, 2015 11:50 am

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.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: How to list all objects

Veeam Logoby dragan.bodrozic » Mon Aug 31, 2015 2:47 pm

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
------ -------
-------------------------------------------------------------------------------
...
dragan.bodrozic
Novice
 
Posts: 8
Liked: 3 times
Joined: Thu Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic

Re: How to list all objects

Veeam Logoby v.Eremin » Mon Aug 31, 2015 3:03 pm

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.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: How to list all objects

Veeam Logoby dragan.bodrozic » Mon Aug 31, 2015 4:05 pm

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
dragan.bodrozic
Novice
 
Posts: 8
Liked: 3 times
Joined: Thu Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic

Re: How to list all objects

Veeam Logoby v.Eremin » Mon Aug 31, 2015 4:15 pm

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.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: How to list all objects

Veeam Logoby dragan.bodrozic » Mon Aug 31, 2015 4:56 pm 1 person likes this post

Good job. It works!
dragan.bodrozic
Novice
 
Posts: 8
Liked: 3 times
Joined: Thu Nov 21, 2013 12:52 pm
Full Name: Dragan Bodrozic

Re: How to list all objects

Veeam Logoby v.Eremin » Mon Aug 31, 2015 5:01 pm

You're welcome. Should other help with scripting be needed, I'd be glad to help. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 4 guests