Windows – Using osQuery Tool

February 1, 2019

The osQuery Tool is a cross-platform tool to query your devices like a database for Windows, Linux and iOS.

Osquery uses basic SQL commands to leverage a relational data-model to describe a device.

You can dowload it here

osQuery installation on Windows is running the MSI to get it running.

After the installation you will see the binaries in C:\ProgramData\osquery

image

As you can see it has a few PowerShell scripts as well.

But most importantly is the osQuery Shell called osqueryi.exe

If you run the shell command you can see all features like this :

osqueryi .help

image

in the background it uses SQLite Smile

image

You can list all the tables that can be queried like this

image

image

Since you now have the list of the tables you can start using it in a Query.

How to use it :

Example :

osqueryi -line "select * from video_info"

image

osqueryi -line "select * from cpu_info"

image

PowerShell :

You can use osqueryi.exe in PowerShell like this

image

Enjoy !

Advertisements

MS SQL – Install only SSMS to do an Azure Backup

May 9, 2018

If you need to install only the SQL Management Studio these days, you will need to go to maximum SQL 2014 !

In the later versions this is not possible anymore to separately selecting the SSMS

Solution :

Download the version INCLUDING the ADVANCED TOOLS

https://www.microsoft.com/en-us/download/details.aspx?id=42299

image

Use this option

image

Choose only “Management Tools – Basic and Management Tools – Complete” as shown below:

image

image

And you are ready to rock and roll … Smile

image

Tip : When you need to do an SQL Azure Backup to an onside server YOU NEED SSMS a the tool to do so !

image

image

It will save your SQL Backup as *.bacpac file

See here for more info :

https://mikhail.io/2016/10/azure-sql-databases-backups-disaster-recovery-import-export/

Export can also be triggered from Azure Portal and PowerShell scripts or using Command Line Tools :

Data-Tier Application Framework : https://www.microsoft.com/en-us/download/details.aspx?id=46898

SqlPackage.exe is part of the SSDT : https://docs.microsoft.com/en-us/sql/ssdt/download-sql-server-data-tools-ssdt?view=sql-server-2017

More info : https://msdn.microsoft.com/en-us/library/hh531248(v=vs.103).aspx

Enjoy !


MS SQL – Query & Reporting Tools

November 11, 2017

Getting data out of a Database hasn’t been easier these days. Giving all the tools you have at your disposal…

Giving the fact that all the fuss about BI and Cloud Storage, Big Data etc. We seem to loose feeling with all the o

image

Here are a few examples we can use for simple and complex query and reporting purposes.

1. Query using the MS SQL SSMS

It’s obvious that SQL SSMS offers all the functionality you need to get the data out of the database.

This example shows a combination of Common Table Expression (CTE) Query combined with the PIVOT function, to generate you dataset.

image

2. Using PowerShell – Query

Re-using this quite complex Query using Scripting language is quite Powerful.

image

image

3. Excel – Query

Using Excel combined with MS Query we can re-use the same Query

image

image

image

image

4. Access – Pass-Through Query

Re-using the complex query using MS Access in a Pass-Through Query Statement.

image

image

image

5. MS SQL Reporting Services

Re-using the complex query using MS SQL Reporting Services & Report Builder

image

image

6. MS PowerPivot – Excel Addin

Re-using the complex query using MS Power Pivot – Addin

image

image

image

image

image

7. MS Power BI

Re-using the complex query using MS Power BI

image

image

This is not a limit list of tools you have a hand. There many more which you might overlook …

QlikView Client

MS Power Query

– …

For getting data out of a database you need to the proper tools, but this is not a constraint at the moment.

What is, is being able to manage all these different applications and technologies.

Bottom-line is that one you spend efforts in getting your queries right you can re-use them most any tool that comes around Smile