Fetch Installation Path for SQL Server

Version 1
    Share:|

    The Below is powershell command to fetch the Installed path of MS Sql Server:

     

    $service = get-wmiobject -query 'select * from win32_service where name="MSSQLSERVER"';

    echo $service.pathname

     

    Sample Output

    "C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Binn\sqlservr.exe" -sMSSQLSERVER

     

     

    You can run this powershell command in Bladelogic as NSHScript Job Type 3.

     

    Thanks

    Siddu