Debug Hyper-V VBSCript Samples
One of customers was not able to get the DNS name from a VM by running the samples at: https://msdn.microsoft.com/en-us/library/cc723870(VS.85).aspx
I debugged and found out that the Win2008 Virtual System was still running Hyper-V beta. Here are the steps that I took:
- Copied the VBScript from the MSDN website above.
- Saved the VBScript as GetVirtualSystemDNSName.vbs
- Ran following command: cscript /X GetVirtualSystemDNSName.vbs vmName
- Selected "New Instance of Visual Studio" as "Just in time debugger"
- Set break point at line 97 as shown in the picture below.
When I watched the values that was returned in the exchange items, the exchange item "Name" was "Fqdn". In the sample code, we tried to find Virtual System FullyQualifiedDomainName Kvp exchange item by running following XPath query:
xpath = "/INSTANCE/PROPERTY[@NAME='Name']/VALUE[child:text() = 'FullyQualifiedDomainName']"
The query returned empty node set sicne "Fqdn" != "FullyQualifiedDomainName".
Fqdn was renamed to FullyQualifiedDomainName after Hyper-V beta.
In the debug watch window, there are other Kvp exchange items. By exploring the their contents from watch window, you will find that this sample code can be modified to retrive other Kvp items.
Cheers,
Howard.