This script is updated. Get the new version here: http://virtexperience.com/2012/09/04/pvs-and-xenserver-device-creation-script-version-2/
I made this script a while ago, for creating XenApp PVS devices based on vm’s running on Xenserver. The script polls XenServer for all VM’s and creates a text file. The textfile can be modified and then used for provisioning PVS devices in the PVS database, DHCP and Active Directory.
The script is very simple and does not provide much of error management so please test before use.
Copy and paste the script below, save as pvsscript.vbs. Modify variables and run:
Enter xenserver password.
Select Yes if you want a fresh VM list from xenserver, no to use previous result file.
Select Yes to see the results in a notepad window. Recommended! You may edit the list before continuing, to remove existing devices and excluded devices from list. Also, xenserver connection errors will show in the notepad window. Select no to just continue with the list unedited.
When finished editing list. Save and close notepad.
Click Yes to start PVS deployment, no to exit script.
Information about device being deployed. (Comment out this in script to reduce number of clicks, or run with cscript.exe)
IF DHCP servers is specified in the script, you will be asked to provide an IP for the device. This IP will be reserved in both DHCP servers and scope options for PVS will be added to the reservation. Note that for a redundant DHCP you should add reservations outside DHCP range, to be able to reserve the same IP on both DHCP servers.
Verify that all devices now exists in both DHCP servers, Active directory, and Provisioning Console.
DISCLAIMER! The use of this script is completely on your own risk. Always test before using in production!
|on error resume next‘Xen/PVS deployment script
‘By Magnar Johnsen Firstpoint AS
‘This script will list all virtual servers in a xenserver pool to a txt file for import to PVS server
‘Xenserver console installed locally
‘PVS server locally
‘DHCP role added locally if you want to deploy VM’s in DHCP. (no need to run scopes locally only the netsh tools needs the role added)
‘You will be prompted for xenserver password and ipaddress per server.
‘Please update the variables below this line
‘if you want to reserve IP for the VM in DHCP, enter DHCP server name. Blank will skip.
‘For redundant DHCP, enter next DHCP server.
‘End of variables
Set objFSO = CreateObject(“Scripting.FileSystemObject”)
res1=msgbox(“Do you want to read VM list from Xen now?”, vbyesno)
res2=msgbox(“Do you want to modify or verify the result now? ” & vbCrLf & ”(Opens vm list in notepad. Change list, save file and close notepad to continue)”, vbyesno)
res3=msgbox(“Do you want to deploy to PVS now?”, vbyesno)
if res3 = vbyes then