HYPER-V query ?

  • i want to query hyper-v with my sql server using sql query any idea plzz

    thank you for help

  • so you want to know if your SQL server is contained in a HyperV environment? is that the question?

    i know @@version contains a string when it's in a VM: we use VMWare, i think, and my @@verison says this:

    Microsoft SQL Server 2008 R2 (SP3) - 10.50.6000.34 (X64)

    Aug 19 2014 12:21:34

    Copyright (c) Microsoft Corporation

    Developer Edition (64-bit) on Windows NT 6.1 <X64> (Build 7601: Service Pack 1) (Hypervisor)

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • I don't know of any way to query the hypervisor from within T-SQL. Not directly. Assuming the login your SQL Server instance operates under has permission to the hypervisor, it's possible to run queries against it from the PowerShell or the command prompt, but not using T-SQL.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • thank you

    so the question is :how can i export the data from hyper-v to my sql table (sql server ) using powershell

    for exemple i want to export the result of get-vm (name,state,cpu usage....) into a table in my database

    thank youuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu for the help:-)

  • I don't have specific scripts that I can supply you. However, the documentation is very clear. You can use the HyperV cmdlets to query the hypervisor. You can then use the SQL Server cmdlets to write to the database what you read from the hypervisor.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply