Help Center
Choose product document...
Veeam ONE 9.5
Business View User Guide

Synchronizing Data with a Sample Script

This section describes how to synchronize categorization data for VMware vSphere using a sample Microsoft PowerShell script. The script creates a CSV file based on Active Directory data. To follow this example, make sure Microsoft PowerShell installed on the Veeam ONE Server.

Step 1. Create a Script

Create a script file named AD2CSV.ps1 which uses Active Directory infrastructure data to create a CSV file with a categorization model.

A sample script is provided below:

#define maps. Map groups and categories to specific folder in AD
#("category", "group", "folder in AD", "path to folder in AD")
("Location_", "UK_", "Computers UK", "DC=MyDomain,DC=local"),
("Location_", "US_", "Computers US", "DC=MyDomain,DC=local"),
("Department_", "IT_", "IT", "OU=Computers UK,DC=MyDomain,DC=local"),
("Department_", "Sales_", "Sales", "OU=Computers UK,DC=MyDomain,DC=local"),
("Department_", "HR_", "HR", "OU=Computers UK,DC=MyDomain,DC=local")

#define constants

# parse maps and extract categories for furture use
foreach($map in $maps)
   foreach($gcat in $categories)
       if($gcat -eq $c)
   if($exist -eq 0) { $categories+=$c }
#end of extracting categories

# initialize active directory
$query=new-object system.directoryservices.directorysearcher
$query.searchRoot = $root

# store results here

foreach($map in $maps)
   # initialize variables

   # find organization unit
   $node=$query.findall() | where {$_.path -match $path}    

   # find computers
   $cq=new-object system.directoryservices.directorysearcher

   foreach($computer in $computers)
       $resultRow=@{} | select vCenterServer, ObjectType, ComputerName, IPAddress, Name
       # make a row with specified groups and categories for each computer
       foreach($c in $categories)
           if($c -eq $category) { $g=$group }
           $resultRow=$resultRow | select *, @{n=$c; e={$g}}

       # find out add this row or just modify group for category
       foreach($rr in $result)
           # if computer already exists in result, than modify specified category
           if($rr.ComputerName -eq $resultRow.ComputerName)
       # if computer doesn't exist in result add computer with specified category and group
       if($na -eq 1)

$result | sort name | export-csv $const_exportFile -notypeinformation -delimiter ";"

Step 2. Create a Batch File That Calls the Script

Create a batch file named Script.bat that runs a command to call AD2CSV.ps1 and output its results to the resultFile.csv file. An example of the command for the batch file is provided below:

cmd /c start /wait powershell -command "& 'C:\AD2CSV.ps1' MyVC c:\resultFile.csv"

Note that you need to replace 'MyVC' with the name of the vCenter Server you are using.

Step 3. Specify Paths to the .CSV and Script Files

Specify paths to the CSV file and the script file in Veeam ONE Business View:

  1. Open Veeam Backup & Replication.
  2. Open the Configuration tab.
  3. In the Configuration menu on the left, click Import/Export.
  4. In the Specify a CSV file to be used for tags synchronization field, specify a path to the resultFile.csv file.
  5. Select the Execute this script before synchronizing with a CSV file check box and specify a path to the Script.bat file in the field below.

Synchronize Data with a Sample Script

Expected Result

When Veeam ONE runs data collection for Veeam ONE Business View, it will call the batch file. The batch file will execute a script that will create an output CSV file with the categorization data. Data from this CSV file will be imported in Veeam ONE Business View. This way Veeam ONE Business View categorization will be synchronized with Active Directory.

You can also configure the synchronization without the script file. In this case, you will need to specify the path to the CSV file and update it manually when needed. However, using the script file allows you automate these updates if your environment changes frequently.

Veeam Large Logo

Deployment Guide

Deployment for Large-Scale Environments

Monitor User Guide

Reporter User Guide

Business View User Guide

Multi-Tenant Monitoring and Reporting

Working with Alarms

Veeam Backup & Replication Documentation

Veeam Agent for Windows Documentation

Veeam Agent for Linux Documentation

Veeam Management Pack Documentation