Skip to content

Instantly share code, notes, and snippets.

@sk8tz
sk8tz / GetDrives.cs
Created August 31, 2016 17:26 — forked from MiloszKrajewski/GetDrives.cs
Get drive information (C#, Windows, WMI)
var driveQuery = new ManagementObjectSearcher("select * from Win32_DiskDrive");
foreach (ManagementObject d in driveQuery.Get())
{
var deviceId = d.Properties["DeviceId"].Value;
//Console.WriteLine("Device");
//Console.WriteLine(d);
var partitionQueryText = string.Format("associators of {{{0}}} where AssocClass = Win32_DiskDriveToDiskPartition", d.Path.RelativePath);
var partitionQuery = new ManagementObjectSearcher(partitionQueryText);
foreach (ManagementObject p in partitionQuery.Get())
{
@sk8tz
sk8tz / get_mem.cs
Created August 31, 2016 17:27 — forked from yasinkuyu/get_mem.cs
C# WMI memory usage
// @yasinkuyu
// 06/05/2014
public dynamic get_mem()
{
dynamic returndata = new ExpandoObject();
var search = new ManagementObjectSearcher("root\\CIMV2", "Select TotalVisibleMemorySize, FreePhysicalMemory from Win32_OPeratingSystem");
foreach (var x in search.Get())
@sk8tz
sk8tz / gist:76bb6d3658bd2d8e9ef284a33bdfcdd6
Created August 31, 2016 17:32 — forked from wtarr/gist:5894837
Find percentage used physical memory - with aid of WMI code generator http://www.microsoft.com/en-ie/download/details.aspx?id=8572
using System;
using System.Management;
namespace WMIQuery
{
public class UsedPhysicalMemoryQuery
{
public static void Main()
{
try
@sk8tz
sk8tz / README.md
Created January 4, 2018 19:01 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.

For more about AWS and AWS Certifications and updates to this Gist you should follow me @leonardofed