This section explains the procedure for automatically linking added virtual PCs with L-Servers.
When automatically linking added virtual PCs with L-Servers, the administrator creates the following scripts and definition files.
The Resource Orchestrator admin server
Any desired string of alphanumeric characters, with the extension "bat".
Shift-JIS
The command executed successfully.
An error has occurred.
The content of the script for linking with L-Servers is as follows.
@echo off setlocal enabledelayedexpansion set AUTO_CONVERT_PATH=%~dp0 set RUN_SCRIPT="Installation_folder\SVROR\Manager\bin\convertVMtoLServer" set CSVPATH=Absolute_path_of_the_folder_for_storing_the_CSV_configuration_file set CSVFILE=convertVMtoLserver.csv set CSVFULLPATH=%CSVPATH%\%CSVFILE% set CSVTEMP=%CSVPATH%\temp.csv set UNCONVERT_VMNAMES=%AUTO_CONVERT_PATH%\unconvert_vmname.txt set RESULTCSVFILE=%CSVPATH%\convertVMtoLserver_result.csv echo [%DATE:/=-% %TIME%] auto convert Start call %RUN_SCRIPT% -exportfile "%CSVPATH%" -fixfilename if not !errorlevel!==0 ( echo make csv file failed. echo [%DATE:/=-% %TIME%] auto convert End exit /b 1 ) else ( if exist "%UNCONVERT_VMNAMES%" ( for %%a in ("%UNCONVERT_VMNAMES%") do ( if not "%%~za" equ "0" ( for /f "tokens=1 delims=" %%i in ('findstr /v /g:"%UNCONVERT_VMNAMES%" "%CSVFULLPATH%"') do ( echo %%i>>"%CSVTEMP%") del "%CSVFULLPATH%" ren "%CSVTEMP%" "%CSVFILE%" ) ) ) call %RUN_SCRIPT% -file "%CSVFULLPATH%" if not !errorlevel!==0 ( echo display convertVMtoLserver.csv start for /f "tokens=*" %%a in (%RESULTCSVFILE%) do echo %%a echo display convertVMtoLserver.csv end echo convert lserver or make xml file failed. echo [%DATE:/=-% %TIME%] auto convert End exit /b 1 ) ) echo convert lserver is successfully completed. echo [%DATE:/=-% %TIME%] auto convert End exit /b 0
Note
If you linked virtual PCs by executing the convertVMtoLServer command with the -fixfilename option specified, the CSV results file will always be named "convertVMtoLserver_result.csv".
If there is already a CSV results file with the same name in the output destination directory, that CSV file will be deleted and then re-created. If the convertVMtoLServer command is executed with the -file option specified and the exit status is something other than "0", the contents of the CSV results file will be output to standard output.
Only alphanumeric characters, underscores ("_"), and hyphens ("-") can be used in the absolute path of the folder for storing the CSV configuration file.
The content of the definition file for excluding virtual PCs from the targets of batch linking is shown below.
By specifying resource pool names, VM host names, and virtual PC names, it is possible to exclude specific virtual PCs from being linked as a batch.
The same folder as the script for linking with L-Servers
unconvert_vmname.txt
Shift-JIS
CR/LF
Describe the file using the following format. Do not enter blank spaces or empty lines.
/Resource_pool_name/VM_host_name/Name_of_virtual_PC_1_to_be_excluded_from_the_targets_of_batch_linking |
Example
/VMHostPool/vmesx3/win2008
/VMHostPool/vmesx2/win2003
It is possible to automatically link added virtual PCs with L-Servers by registering the script created in "3.3.4.1 Creating the Script for Linking with L-Servers" in the OS Task Scheduler so it is executed periodically.
The procedure for registering the script for linking with L-Servers in the OS Task Scheduler and configuring it to be executed periodically is as follows:
Copy the script file created in "3.3.4.1 Creating the Script for Linking with L-Servers" to the desired storage location.
In addition, if there are virtual PCs which are excluded from the targets of batch linking, copy the definition file for excluding virtual PCs from the targets of batch linking to the same location.
Log in to the admin server as the OS administrator.
Start the Task Scheduler.
The icons to click to start the Task Scheduler are as follows:
For Windows Server 2008
[System and Maintenance]-[Administrative Tools]-[Task Scheduler]
For Windows Server 2008 R2
[System and Security]-[Administrative Tools]-[Task Scheduler]
For Windows Server 2012 and Windows Server 2012 R2
[Start]-[Administrative Tools]-[Task Scheduler]
For Windows Server 2016
[Start]-[Windows Administrative Tools]-[Task Scheduler]
Set the following in the Task Scheduler:
Task name
Task start date and time
The script file copied in step 1 as the program to be executed.
Example
Specifying so that execution results will be output to D:\tmp\auto_convert.log
Script_for_linking_with_L-Servers >> D:\tmp\auto_convert.log 2>&1
Sample execution results
[2017-07-28 10:57:34.62] auto convert Start VmGuest export Start VmGuest export End VmGuest Convert Start VmGuest:/VMHostPool/vmesx2/win2003 convert failed VmGuest Convert End display convertVMtoLserver.csv start VMGuestName,Label,Comment,FolderName,Result,Note /VMHostPool/vmesx2/win2003,,,,NG,FJSVrcx:ERROR:67154:/VMHostPool/vmesx2/win2003:not found display convertVMtoLserver.csv end convert lserver or make xml file failed. [2017-07-28 10:57:37.92] auto convert End